1.0.5 • Published 8 months ago

@mind-net.js/gpu v1.0.5

Weekly downloads
-
License
BSD-3
Repository
github
Last release
8 months ago

mind-net.gpu

Unleash the ⚡️GPU power⚡️ for mind-net.js.

Get Started

  1. Install packages
npm install mind-net.js
npm install @mind-net.js/gpu

Optionally, if you encounter any build issues, you can add overrides for the gl package by modifying your package.json configuration as follows:

{
    //...
    "overrides": {
        "gl": "^6.0.2"
    }
}
  1. Use imported binding
import {SequentialModel, Dense} from "mind-net.js";
import {GpuModelWrapper} from "@mind-net.js/gpu";

const network = new SequentialModel();
network.addLayer(new Dense(2));
network.addLayer(new Dense(64, {activation: "leakyRelu"}));
network.addLayer(new Dense(1, {activation: "linear"}));
network.compile();

// Define the input and expected output data
const input = [[1, 2], [3, 4], [5, 6]];
const expected = [[3], [7], [11]];

// Create GPU wrapper
const batchSize = 128; // Note: batchSize specified only when creating the wrapper
const gpuWrapper = new GpuModelWrapper(network, batchSize);

// Train model
gpuWrapper.train(input, expected);

// Compute predictions
const predictions = gpuWrapper.compute(input);

// Free resources
gpuWrapper.destroy();
1.0.5

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago