← All repositories

tensorflowtfjs-examples

6,783 stars2,356 forksJavaScriptapache-2.00 views
js.tensorflow.org

Tfjs Examples

Features

  • Manual Memory ManagementLayer and model objects provide a manual disposal method to free GPU-resident memory, as the environment may lack automatic garbage collection for these resources.
  • Core Model APIsA low-level API allowing for manual weight initialization and custom model logic by defining functions that operate directly on tensors for specialized machine learning tasks.
  • Model Execution APIsSpecialized loading interfaces to fetch and execute converted model assets, supporting both fixed-parameter graph models and trainable layer-based models.
  • Asynchronous Training UtilitiesAn asynchronous model training method that returns a promise, preventing UI thread blocking during long-running training operations.
  • CPU BackendsA server-side backend accelerated by native binaries that optimizes linear algebra computation on the CPU across multiple operating systems.
  • Backend Kernel ImplementationsBackend-specific kernels provide optimized logic for operations by directly reading and writing memory, registered via a central registry for dispatch during execution.
  • Tensor Memory ManagementExplicit memory management utilities including manual disposal and automated cleanup scopes for managing tensor lifecycles, particularly critical when using GPU-based backends.