{"_id":"executorch","_rev":"7-bc7a87f312870675077d52885b456e16","name":"executorch","dist-tags":{"latest":"0.0.7"},"versions":{"0.0.1-dev":{"name":"executorch","version":"0.0.1-dev","author":{"name":"zcbenz"},"license":"MIT","_id":"executorch@0.0.1-dev","maintainers":[{"name":"zcbenz","email":"zcbenz@gmail.com"}],"homepage":"https://github.com/frost-beta/executorch.js#readme","bugs":{"url":"https://github.com/frost-beta/executorch.js/issues"},"dist":{"shasum":"ca6f5334ed33ac0608564fab73d727dc4ea8338a","tarball":"https://registry.npmjs.org/executorch/-/executorch-0.0.1-dev.tgz","fileCount":20,"integrity":"sha512-LIq3r/XToIiyr6vS6U+NSfyTb5k7WEjKtc83K+IhujgQnUEN1oj16XFaN0Y5HfTmswZihfL+Vv3hZdLLo612Bw==","signatures":[{"sig":"MEUCIQC1q8Ivg7reh6ftKp//BhzF8lMvdj9TH1efogAXWAEQtwIgKTFG05XpZS94Fy4bLwXPflawUDgR3B/W4fkCndH41Hg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2692181},"main":"dist/index.js","types":"dist/index.d.ts","binary":{"napi_versions":[9]},"gitHead":"0d7d2d13a1441413c7094679d9ec18764c5eb3f7","scripts":{"test":"tsx tests/run.ts","build":"cmake-js build","install":"node install.js","prepack":"tsc","pretest":"tsc --project tests/tsconfig.json --noEmit","prebuild":"tsc"},"_npmUser":{"name":"zcbenz","email":"zcbenz@gmail.com"},"repository":{"url":"git+https://github.com/frost-beta/executorch.js.git","type":"git"},"_npmVersion":"10.8.3","description":"JavaScript bindings for [ExecuTorch](https://pytorch.org/executorch-overview), a runtime for inferencing PyTorch models.","directories":{},"_nodeVersion":"22.9.0","_hasShrinkwrap":false,"devDependencies":{"tsx":"4.19.1","chai":"4.3.7","mocha":"10.4.0","cmake-js":"7.3.0","typescript":"5.6.2","@types/chai":"4.3.14","@types/node":"22.5.4","@types/mocha":"10.0.7"},"_npmOperationalInternal":{"tmp":"tmp/executorch_0.0.1-dev_1731463296498_0.6130982785953969","host":"s3://npm-registry-packages"}},"0.0.1":{"name":"executorch","version":"0.0.1","author":{"name":"zcbenz"},"license":"MIT","_id":"executorch@0.0.1","maintainers":[{"name":"zcbenz","email":"zcbenz@gmail.com"}],"homepage":"https://github.com/frost-beta/executorch.js#readme","bugs":{"url":"https://github.com/frost-beta/executorch.js/issues"},"dist":{"shasum":"e1d2f7dc529566fd91b6ab7545374ec69c7f5004","tarball":"https://registry.npmjs.org/executorch/-/executorch-0.0.1.tgz","fileCount":20,"integrity":"sha512-kVkxVa4joso3rWbqDM0GY6L5s4k5nwy/Lgh38BWXZqGv+h4lFfTFF0Z2EirsEsVajqMu8hQTHCT9bGPsFtMRGg==","signatures":[{"sig":"MEUCIHfRplNH4gcr/T0kGdyBs6ZBChFaBCkxwFFPi0dk9qrcAiEA4tPipNY0W6ojEzQ5L7G8tdXCP9jMlvS57csIutdpe/Y=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5097574},"main":"dist/index.js","types":"dist/index.d.ts","binary":{"napi_versions":[9]},"gitHead":"dbd8911263919593005a46e3d4cbc6436f4d41e2","scripts":{"test":"tsx tests/run.ts","build":"cmake-js build","install":"node install.js","prepack":"tsc","pretest":"tsc --project tests/tsconfig.json --noEmit","prebuild":"tsc"},"_npmUser":{"name":"zcbenz","email":"zcbenz@gmail.com"},"repository":{"url":"git+https://github.com/frost-beta/executorch.js.git","type":"git"},"_npmVersion":"10.9.0","description":"JavaScript bindings for [ExecuTorch](https://pytorch.org/executorch-overview), a runtime for inferencing PyTorch models.","directories":{},"_nodeVersion":"22.10.0","_hasShrinkwrap":false,"devDependencies":{"tsx":"4.19.1","chai":"4.3.7","mocha":"10.4.0","cmake-js":"7.3.0","typescript":"5.6.2","@types/chai":"4.3.14","@types/node":"22.5.4","@types/mocha":"10.0.7"},"_npmOperationalInternal":{"tmp":"tmp/executorch_0.0.1_1731464065427_0.668867453063315","host":"s3://npm-registry-packages"}},"0.0.2":{"name":"executorch","version":"0.0.2","author":{"name":"zcbenz"},"license":"MIT","_id":"executorch@0.0.2","maintainers":[{"name":"zcbenz","email":"zcbenz@gmail.com"}],"homepage":"https://github.com/frost-beta/executorch.js#readme","bugs":{"url":"https://github.com/frost-beta/executorch.js/issues"},"dist":{"shasum":"f2f89be254b0bec45345c95ab34851a4713a491c","tarball":"https://registry.npmjs.org/executorch/-/executorch-0.0.2.tgz","fileCount":20,"integrity":"sha512-vSXBpkkPAmWE/IN0oRCEvIWRVX9dvFngE5lQlEz5y5XN0cSs4ft1gN/1O0DYmjufCh/txXL/2ynYOh+jNpIBIA==","signatures":[{"sig":"MEUCIEpg2k98OgOCFcXhsXC/le2AycxCVhBhkjHOPebQeE46AiEAgc13UDGXIf5DZ8HwXNmR+DJB5vXsg+/y9t25+eiGnpk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5097574},"main":"dist/index.js","types":"dist/index.d.ts","binary":{"napi_versions":[9]},"gitHead":"972c70873cc35fc632f7c01d30cfce2e3cb1134d","scripts":{"test":"tsx tests/run.ts","build":"cmake-js build","install":"node install.js","prepack":"tsc","pretest":"tsc --project tests/tsconfig.json --noEmit","prebuild":"tsc"},"_npmUser":{"name":"zcbenz","email":"zcbenz@gmail.com"},"repository":{"url":"git+https://github.com/frost-beta/executorch.js.git","type":"git"},"_npmVersion":"10.9.0","description":"JavaScript bindings for [ExecuTorch](https://pytorch.org/executorch-overview), a runtime for inferencing PyTorch models.","directories":{},"_nodeVersion":"22.10.0","_hasShrinkwrap":false,"devDependencies":{"tsx":"4.19.1","chai":"4.3.7","mocha":"10.4.0","cmake-js":"7.3.0","typescript":"5.6.2","@types/chai":"4.3.14","@types/node":"22.5.4","@types/mocha":"10.0.7"},"_npmOperationalInternal":{"tmp":"tmp/executorch_0.0.2_1731465358200_0.2725916147418703","host":"s3://npm-registry-packages"}},"0.0.3":{"name":"executorch","version":"0.0.3","author":{"name":"zcbenz"},"license":"MIT","_id":"executorch@0.0.3","maintainers":[{"name":"zcbenz","email":"zcbenz@gmail.com"}],"homepage":"https://github.com/frost-beta/executorch.js#readme","bugs":{"url":"https://github.com/frost-beta/executorch.js/issues"},"dist":{"shasum":"76aa7b13fc7db0dc269bb628698813fbc2deb1cd","tarball":"https://registry.npmjs.org/executorch/-/executorch-0.0.3.tgz","fileCount":20,"integrity":"sha512-SPa5Ufp7v4fhlBk1ncQr0f8gGj2edPBwTIIgCJvvMAhZb9YcoueVQj1Tegs+QfJwx6VsThP1sNiYUSSLle5Rlw==","signatures":[{"sig":"MEUCIQCHBLcAZUndx2tuU4ZpJge1NYZ5zeKvnDVvNxvvrhIYMAIgWWbbFH8tzL5hc2zDABboq+A1H5rdofh2/shYuHYzBMU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5103750},"main":"dist/index.js","types":"dist/index.d.ts","binary":{"napi_versions":[9]},"gitHead":"25e024f4f806d750c8e0c33dbe48967613556140","scripts":{"test":"tsx tests/run.ts","build":"cmake-js build","install":"node install.js","prepack":"tsc","pretest":"tsc --project tests/tsconfig.json --noEmit","prebuild":"tsc"},"_npmUser":{"name":"zcbenz","email":"zcbenz@gmail.com"},"repository":{"url":"git+https://github.com/frost-beta/executorch.js.git","type":"git"},"_npmVersion":"10.9.0","description":"JavaScript bindings for [ExecuTorch](https://pytorch.org/executorch-overview), a runtime for inferencing PyTorch models.","directories":{},"_nodeVersion":"22.10.0","_hasShrinkwrap":false,"devDependencies":{"tsx":"4.19.1","chai":"4.3.7","mocha":"10.4.0","cmake-js":"7.3.0","typescript":"5.6.2","@types/chai":"4.3.14","@types/node":"22.5.4","@types/mocha":"10.0.7"},"_npmOperationalInternal":{"tmp":"tmp/executorch_0.0.3_1731556622206_0.3038648948260747","host":"s3://npm-registry-packages"}},"0.0.4":{"name":"executorch","version":"0.0.4","author":{"name":"zcbenz"},"license":"MIT","_id":"executorch@0.0.4","maintainers":[{"name":"zcbenz","email":"zcbenz@gmail.com"}],"homepage":"https://github.com/frost-beta/executorch.js#readme","bugs":{"url":"https://github.com/frost-beta/executorch.js/issues"},"dist":{"shasum":"242f5aeba1c519370d3c93bdb8e8646c56ffae8a","tarball":"https://registry.npmjs.org/executorch/-/executorch-0.0.4.tgz","fileCount":20,"integrity":"sha512-DPZLsV6kLbw4VL9HFw/gz8N0bO4r6OwrA/TofGSwkNz5QPhemXXizrB8xieM5GehAgxFX73Z6cauwbigqNATDA==","signatures":[{"sig":"MEYCIQCZsIsgIEfhj9DZeYq1wPMBwig+ZxBNxEqSwIIHD1mCygIhAJ2vYoCtno9fF9lnM/yo1d2w8/J5uqg2LmCewWS1Gfdl","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":17613866},"main":"dist/index.js","types":"dist/index.d.ts","binary":{"napi_versions":[9]},"gitHead":"5f8cee4251e2aa36f9eae51f3edb67a460368a05","scripts":{"test":"tsx tests/run.ts","build":"cmake-js build","install":"node install.js","prepack":"tsc","pretest":"tsc --project tests/tsconfig.json --noEmit","prebuild":"tsc"},"_npmUser":{"name":"zcbenz","email":"zcbenz@gmail.com"},"repository":{"url":"git+https://github.com/frost-beta/executorch.js.git","type":"git"},"_npmVersion":"10.9.0","description":"JavaScript bindings for [ExecuTorch](https://pytorch.org/executorch-overview), a runtime for inferencing PyTorch models.","directories":{},"_nodeVersion":"22.10.0","_hasShrinkwrap":false,"devDependencies":{"tsx":"4.19.1","chai":"4.3.7","mocha":"10.4.0","cmake-js":"7.3.0","typescript":"5.6.2","@types/chai":"4.3.14","@types/node":"22.5.4","@types/mocha":"10.0.7"},"_npmOperationalInternal":{"tmp":"tmp/executorch_0.0.4_1731556678721_0.6615252654648556","host":"s3://npm-registry-packages"}},"0.0.5":{"name":"executorch","version":"0.0.5","author":{"name":"zcbenz"},"license":"MIT","_id":"executorch@0.0.5","maintainers":[{"name":"zcbenz","email":"zcbenz@gmail.com"}],"homepage":"https://github.com/frost-beta/executorch.js#readme","bugs":{"url":"https://github.com/frost-beta/executorch.js/issues"},"dist":{"shasum":"5d0854a6b8ac6ea7a3595f44ceca6ebc3c33622b","tarball":"https://registry.npmjs.org/executorch/-/executorch-0.0.5.tgz","fileCount":20,"integrity":"sha512-OIsOkJHj67j08kuVUE5kqg3b0E0D2QF0xBcHKXqW7DkClMyloDKBQfPpi0Pc0bOMdjY9NfjxIwi44ph70YqDIg==","signatures":[{"sig":"MEYCIQDTbpSuCP6oZ13ALm1jq3XT9X4r1Lb3rMawsBRi+jSlgwIhAOWcOHtQF1Dmxu3J73RRILUXXAsRT6qToM6goQ+VeVbC","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":17670885},"main":"dist/index.js","types":"dist/index.d.ts","binary":{"napi_versions":[9]},"gitHead":"af4eec52d6ffbd04f37da9640bc46504f5400e55","scripts":{"test":"tsx tests/run.ts","build":"cmake-js build","install":"node install.js","prepack":"tsc","pretest":"tsc --project tests/tsconfig.json --noEmit","prebuild":"tsc"},"_npmUser":{"name":"zcbenz","email":"zcbenz@gmail.com"},"repository":{"url":"git+https://github.com/frost-beta/executorch.js.git","type":"git"},"_npmVersion":"10.9.0","description":"JavaScript bindings for [ExecuTorch](https://pytorch.org/executorch-overview), a runtime for inferencing PyTorch models.","directories":{},"_nodeVersion":"22.10.0","_hasShrinkwrap":false,"devDependencies":{"tsx":"4.19.1","chai":"4.3.7","mocha":"10.4.0","cmake-js":"7.3.0","typescript":"5.6.2","@types/chai":"4.3.14","@types/node":"22.5.4","@types/mocha":"10.0.7"},"_npmOperationalInternal":{"tmp":"tmp/executorch_0.0.5_1731574695588_0.03607390194579785","host":"s3://npm-registry-packages"}},"0.0.6":{"name":"executorch","version":"0.0.6","author":{"name":"zcbenz"},"license":"MIT","_id":"executorch@0.0.6","maintainers":[{"name":"zcbenz","email":"zcbenz@gmail.com"}],"homepage":"https://github.com/frost-beta/executorch.js#readme","bugs":{"url":"https://github.com/frost-beta/executorch.js/issues"},"dist":{"shasum":"4f770e00ff2c8dcc653ba587bb373035c5cfb451","tarball":"https://registry.npmjs.org/executorch/-/executorch-0.0.6.tgz","fileCount":20,"integrity":"sha512-BJHyuwlXGP0suPM/aHOXtvroQyGXu0n6dBCc8zbmHE3cFfU/lRb1Q+Uh+EZBx5MXO+kMF2EqkthcnLb4vdsdzw==","signatures":[{"sig":"MEUCIGk44JW4QtiisqSWiaRwwL+goLbBhah8kvi9YcO8cL3QAiEA+F7CaAFaZLB0m7hPGzV6bUbYEFbA2tkX8pqXsQATRbM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":17671884},"main":"dist/index.js","types":"dist/index.d.ts","binary":{"napi_versions":[9]},"gitHead":"8e44386d1a55bb79008ebf1986506c18eff45b61","scripts":{"test":"tsx tests/run.ts","build":"cmake-js build","install":"node install.js","prepack":"tsc","pretest":"tsc --project tests/tsconfig.json --noEmit","prebuild":"tsc"},"_npmUser":{"name":"zcbenz","email":"zcbenz@gmail.com"},"repository":{"url":"git+https://github.com/frost-beta/executorch.js.git","type":"git"},"_npmVersion":"10.9.0","description":"JavaScript bindings for [ExecuTorch](https://pytorch.org/executorch-overview), a runtime for inferencing PyTorch models.","directories":{},"_nodeVersion":"22.10.0","_hasShrinkwrap":false,"devDependencies":{"tsx":"4.19.1","chai":"4.3.7","mocha":"10.4.0","cmake-js":"7.3.0","typescript":"5.6.2","@types/chai":"4.3.14","@types/node":"22.5.4","@types/mocha":"10.0.7"},"_npmOperationalInternal":{"tmp":"tmp/executorch_0.0.6_1731585787229_0.4821980420522165","host":"s3://npm-registry-packages"}},"0.0.7":{"name":"executorch","version":"0.0.7","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"install":"node install.js","prepack":"tsc","prebuild":"tsc","build":"cmake-js build","pretest":"tsc --project tests/tsconfig.json --noEmit","test":"tsx tests/run.ts"},"author":{"name":"zcbenz"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/frost-beta/executorch.js.git"},"bugs":{"url":"https://github.com/frost-beta/executorch.js/issues"},"binary":{"napi_versions":[9]},"devDependencies":{"@types/chai":"4.3.14","@types/mocha":"10.0.7","@types/node":"22.5.4","chai":"4.3.7","cmake-js":"7.3.0","mocha":"10.4.0","tsx":"4.19.1","typescript":"5.6.2"},"_id":"executorch@0.0.7","gitHead":"e920c5396dab861ba57e21d24d68ff84e94a7086","description":"JavaScript bindings for [ExecuTorch](https://pytorch.org/executorch-overview), a runtime for inferencing PyTorch models.","homepage":"https://github.com/frost-beta/executorch.js#readme","_nodeVersion":"22.10.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-BXIoI2M3B8v9u6IqE2khLC1z/AcEQmgLoneRuNM9smKglxdLsDRaqTomyCOOXLVOrWwOK4JrqUcHgECxeHAj0Q==","shasum":"35606fb5daf5eab0f9c3870f7f131963d60b6a92","tarball":"https://registry.npmjs.org/executorch/-/executorch-0.0.7.tgz","fileCount":20,"unpackedSize":18554914,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIALiuhwECB/qxF+0W+mnYdXZE5rgqJT0RwJYoKpINkd8AiEAvNAH57FZEHiWdYb0IfKqaBlvPtT9PF5Eagff2rd3H74="}]},"_npmUser":{"name":"zcbenz","email":"zcbenz@gmail.com"},"directories":{},"maintainers":[{"name":"zcbenz","email":"zcbenz@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/executorch_0.0.7_1731634639793_0.25433346132542356"},"_hasShrinkwrap":false}},"time":{"created":"2024-11-13T02:01:36.497Z","modified":"2024-11-15T01:37:20.291Z","0.0.1-dev":"2024-11-13T02:01:36.759Z","0.0.1":"2024-11-13T02:14:25.724Z","0.0.2":"2024-11-13T02:35:58.474Z","0.0.3":"2024-11-14T03:57:02.444Z","0.0.4":"2024-11-14T03:57:59.000Z","0.0.5":"2024-11-14T08:58:15.883Z","0.0.6":"2024-11-14T12:03:07.536Z","0.0.7":"2024-11-15T01:37:20.089Z"},"bugs":{"url":"https://github.com/frost-beta/executorch.js/issues"},"author":{"name":"zcbenz"},"license":"MIT","homepage":"https://github.com/frost-beta/executorch.js#readme","repository":{"type":"git","url":"git+https://github.com/frost-beta/executorch.js.git"},"description":"JavaScript bindings for [ExecuTorch](https://pytorch.org/executorch-overview), a runtime for inferencing PyTorch models.","maintainers":[{"name":"zcbenz","email":"zcbenz@gmail.com"}],"readme":"# ExecuTorch.js\n\nJavaScript bindings for [ExecuTorch](https://pytorch.org/executorch-overview),\na runtime for inferencing PyTorch models.\n\n## Supported platforms\n\nJavaScript runtimes:\n\n* Node.js >= 22 (and compatible runtimes like Electron and Bun)\n* <i>Plan on: WebAssembly, React Native</i>\n\nPlatforms:\n\n* Linux x64\n* macOS arm64\n* macOS x64\n  * [Some ops](https://github.com/pytorch/executorch/issues/6839) required\n    for running LLMs are not supported yet.\n* <i>Plan on: Windows, Linux arm64, iOS, Android</i>\n\nBackends:\n\n* [MPS](https://developer.apple.com/documentation/metalperformanceshaders) (macOS only)\n* [XNNPACK](https://github.com/google/XNNPACK)\n* <i>Plan on: Vulkan</i>\n\n## Install\n\nYou can install ExecuTorch.js from npm:\n\n```console\n$ npm install executorch\n```\n\nThe default `executorch` package includes support for all backends, for users\nwho want to reduce binary size, you can install packages with specific backeds:\n\n|                             | CPU | MPS | Vulkan | XNNPACK |\n|-----------------------------|-----|-----|--------|---------|\n| executorch                  | ✔️   | ✔️   | ❌      | ✔️       |\n| @executorch/runtime         | ✔️   | 🍏   | ❌      | 🐧       |\n| @executorch/runtime-all     | ✔️   | ✔️   | ❌      | ✔️       |\n| @executorch/runtime-cpu     | ✔️   | ❌   | ❌      | ❌       |\n| @executorch/runtime-mps     | ✔️   | ✔️   | ❌      | ❌       |\n| @executorch/runtime-xnnpack | ✔️   | ❌   | ❌      | ✔️       |\n\nThe `@executorch/runtime` package is a speical one that uses MPS backend on\nmacOS and XNNPACK backend for other platforms.\n\nFor debugging purpose each package also has a Debug version that can be enabled\nby setting the `npm_config_debug` environment variable when installing:\n\n```console\n$ env npm_config_debug=true npm install @executorch/runtime-xnnpack\n```\n\n## Quick start\n\nDownload the mobilenet model:\n\n```console\n$ wget https://huggingface.co/frost-beta/mobilenet-v2-executorch-cpu/resolve/main/mv2.pte\n```\n\nRun following code with Node.js:\n\n```typescript\nimport {Module, Tensor} from 'executorch';\n\n// A tensor of shape [ 1, 3, 224, 224 ].\nconst input = Array.from({length: 1}, () =>\n              Array.from({length: 3}, () =>\n              Array.from({length: 224}, () =>\n              Array.from({length: 224}, () => Math.random()))));\n\nconst mod = new Module('mv2.pte');\nawait mod.load();\nconst output = await mod.forward(new Tensor(input));\nconsole.log(output.tolist());\n```\n\n## Examples\n\n* [llama3-torch.js](https://github.com/frost-beta/llama3-torch.js) - A simple\n  chat CLI for LLama 3.\n\n## APIs\n\n```typescript\n/**\n * Load exported edge PyTorch models.\n */\nexport declare class Module {\n    /**\n     * The methods of this class are dynamically loaded.\n     */\n    [key: string]: Function;\n    /**\n     * @param filePathOrBuffer - When a string is passed, it is treated as file\n     * path and will be loaded with mmap. When a Uint8Array is passed, its content\n     * is used as the model file.\n     */\n    constructor(filePathOrBuffer: string | Uint8Array);\n    /**\n     * Load the model.\n     *\n     * @remarks\n     *\n     * After loading, the model's methods will be added to the instance\n     * dynamically, with both async and async versions for each method, the sync\n     * version will have a \"Sync\" suffix appended to its name.\n     */\n    load(): Promise<void>;\n    /**\n     * Load the model synchronously.\n     */\n    loadSync(): void;\n    /**\n     * Return if any model has been loaded.\n     */\n    isLoaded(): boolean;\n    /**\n     * Return names of loaded model's methods.\n     */\n    getMethodNames(): string[];\n}\n\n/**\n * Data type.\n */\nexport declare enum DType {\n    Uint8,\n    Int8,\n    Int16,\n    Int32,\n    Int64,\n    Float16,\n    Float32,\n    Float64,\n    Bool,\n    BFloat16\n}\n\ntype Nested<T> = Nested<T>[] | T;\n\n/**\n * A multi-dimensional matrix containing elements of a single data type.\n */\nexport declare class Tensor {\n    /**\n     * The tensor's data stored as JavaScript Uint8Array.\n     */\n    readonly data: Uint8Array;\n    /**\n     * Data-type of the tensor’s elements.\n     */\n    readonly dtype: DType;\n    /**\n     * Array of tensor dimensions.\n     */\n    readonly shape: number[];\n    /**\n     * @param input - A scalar, or a (nested) Array, or a Uint8Array buffer.\n     * @param dtype - The data type of the elements.\n     * @param options - Extra information of the tensor.\n     * @param options.shape\n     * @param options.dimOrder\n     * @param options.strides\n     */\n    constructor(input: Nested<boolean | number> | Uint8Array,\n                dtype?: DType,\n                { shape, dimOrder, strides }?: { shape?: number[]; dimOrder?: number[]; strides?: number[]; });\n    /**\n     * Return the tensor as a scalar.\n     */\n    item(): number | boolean;\n    /**\n     * Return the tensor as a scalar or (nested) Array.\n     */\n    tolist(): Nested<number | boolean>;\n    /**\n     * Return a TypedArray view of tensor's data.\n     */\n    toTypedArray(): Int8Array | Uint8Array | Int16Array | Int32Array | Float32Array | Float64Array;\n    /**\n     * A permutation of the dimensions, from the outermost to the innermost one.\n     */\n    get dimOrder(): number[];\n    /**\n     * Array of indices to step in each dimension when traversing the tensor.\n     */\n    get strides(): number[];\n    /**\n     * Number of tensor dimensions.\n     */\n    get ndim(): number;\n    /**\n     * Number of elements in the tensor.\n     */\n    get size(): number;\n    /**\n     * Total bytes consumed by the elements of the tensor.\n     */\n    get nbytes(): number;\n    /**\n     * Length of one tensor element in bytes.\n     */\n    get itemsize(): number;\n}\n\n/**\n * Samples from the given tensor using a softmax over logits.\n */\nexport declare function sample(logits: Tensor,\n                               {\n                                 temperature = 1,\n                                 topP = 1,\n                               }?: { temperature?: number; topP?: number }): number;\n```\n\n## Development\n\nSource code architecture:\n\n* `src/` - C++ source code.\n* `lib/` - TypeScript source code.\n* `bindings.js`/`bindings.d.ts` - Glue code between C++ and TypeScript.\n* `install.js` - Script that downloads compiled binaries when installing.\n* `tests/` - Tests for TypeScript code.\n* `build/` - Generated project files and binaries from C++ code.\n* `dist/` - Generated JavaScript code from TypeScript code.\n","readmeFilename":"README.md"}