Commit Graph

250 Commits

Author SHA1 Message Date
gaikwadrahul8 0ef019b66d
Add NAPI-v9 support to tfjs-node-gpu package (#8547)
* Add NAPI-v9 support to tfjs-node-gpu package

* Update napi version to 9 for tfjs-node
2025-05-29 15:39:13 -07:00
Matthew Soulanille 51577688f1
Move nightly publishing tests and release branch tests to github actions (#8555)
[Example nightly release and publish test](https://github.com/mattsoulanille/tfjs/actions/runs/14672995746/job/41183624273)

[Example release PR test](https://github.com/mattsoulanille/tfjs/actions/runs/14674243426/job/41187438555?pr=1)
2025-04-28 09:07:00 -07:00
Valérian Rousset f2e55729ba
[tfjs-node] replace deprecated utils (#8425)
Co-authored-by: Matthew Soulanille <msoulanille@google.com>
2025-04-23 11:30:04 -07:00
gaikwadrahul8 8206e95ff5
Fix typos in the documentation strings of the tfjs-node directory (#8412) 2024-10-10 22:20:47 +00:00
gaikwadrahul8 737b8f1052
Update tar package version for tfjs-node & tfjs-node-gpu (#8280) 2024-05-21 10:09:24 -07:00
gaikwadrahul8 5092b04251
Update installation steps for Windows / Mac OS X for tfjs-node in README.md (#8101) 2024-04-18 16:02:45 -07:00
Victor Moreno G f224f1db87
Fix for windows installation #7341 (#8122)
* Fix for windows installation #7341

Fix a problem with the installation on windows.
My problem on windows was that `./lib/napi-v9` directory didn't exist and `./scripts/deps-stage.js` on line **60** needed the path to symlink or copy the dll. 

My fix was to make sure that the directory `napi-v9` exists with:
`await fs.mkdir(path.dirname(destLibTensorFlowPath), {recursive: true})`;

I'm solving the copy issue with this code.

* Fix fs.mkdir usage in deps-stage.js
2024-01-09 23:55:09 +00:00
gaikwadrahul8 b004ab65d6
Update broken link for MacOS Catalina guide in README.md (#8032)
Co-authored-by: Linchenn <40653845+Linchenn@users.noreply.github.com>
2024-01-09 19:44:48 +00:00
Ping Yu 89a0b8f103
[converter] fixed py import for auto tracking (#7982)
* update py import for auto tracking

* [e2e] Use ios12 and report karma seed (#7984)

* [e2e] Use ios12 and report karma seed

* Update karma.conf.js

---------

Co-authored-by: Matthew Soulanille <msoulanille@google.com>
2023-10-03 11:01:24 -07:00
Ping Yu f4271a5549
[tfjs-node] fixed range issue for int32 tensor with size larger than 2 ^ 24 (#7931)
* fixed range issue when creating int32 tensor with larger than 2 ^ 24 size

* reduce the size of the test tensor

* remove use of max op

* fixed test

* fixed the test
2023-08-28 18:49:15 +00:00
Matthew Soulanille 93e9af4893
Build node addon before running tests (#7884)
Fix a race condition in CI where the tests may be run before the node addon is built.
2023-07-31 15:16:11 -07:00
Matthew Soulanille 983dc16a4e
Update TypeScript to 5.0.4 (#7681) 2023-07-21 14:55:05 -07:00
Chunnien Chan 80a809108c
[wasm] Fix cos and tan for large float numbers (#7689)
* Fix sin/cos workaround

* Add tests for large numbers

* Fix tan

* Exclude new tests in webgl and webgpu

* Fix

* Exclude tests in tfjs-node

* Update

* Fix

* Fix

* Fix

* Remove comments
2023-05-17 17:22:18 -07:00
Matthew Soulanille 086e9d87a0
Support loading models with weights above 2GB on Chrome (#7609)
Chrome ArrayBuffers throw allocation errors above 2GB in size. This makes it impossible to load TFJS models above this size in Chrome (even with weight sharding) because model loading involves concatenating all the weights into a single ArrayBuffer.

This PR avoids this concatenation. Instead of slicing the weight tensors out of a single concatenated ArrayBuffer, it keeps the weight buffers in their original shards and slices them using the CompositeArrayBuffer class created in #7598.
2023-05-04 14:31:38 -07:00
fengwuyao 2863235e5e
Add bitwiseAnd() ops (#7645)
* Test commit

* Support ensureShape in tfjs

* Applied changes

* Updates doc

* Updates doc

* Updates doc

* Add an example

* add dif length and null shape tests

* fix the lint error

* Update executor tests

* Update the header

* Implement bitwiseAnd() ops and add kernel in Webcpu backEnd

* Fix format

* Change to only support int32 type
2023-05-03 09:57:32 -07:00
Matthew Soulanille 7a3e61a7b3
Fix missing isTypedArray when mixing versions of @tensorflow packages (#7489)
A new function, `isTypedArray` was added to the `platform` interface by #7181
and first published in tfjs-core 4.2.0. This made 4.2.0 incompatible with
earlier versions of backends that implemented `platform`, such as node and
react-native. This change adds a fallback to the use of `isTypedArray` so
earlier versions of platforms that don't implement `isTypedArray` will not throw
an error.

Note that the fallback behavior may not be perfect, such as when running Jest
tests in node. See #7175 for more details and upgrade all @tensorflow scoped
packages to ^4.2.0 to avoid this.
2023-03-21 10:40:14 -07:00
Ping Yu 2a4c873ddb
[tfjs-node] fixed summary writer memory leak (#7490)
BUG
* fixed summary writer memory leak due to the step Int64Scalar internal tensor not deleted after use.

* also fixed a similar issue related to saved model execution
2023-03-16 15:57:54 -07:00
Ping Yu e1fd1f145b
[tfjs-node] Encode jpeg (#7484)
fixed #7459
ensure TF tensors are disposed after encode image op is called.
2023-03-15 16:30:57 -07:00
chunnienc ff6739dd2b
[wasm] Add Multinomial kernel (#7468)
* Add multinomial kernel

* Add test

* Fix mt19937 seed type

* Fix discrete_distribution weight type

* Fix fill

* Ignore seed test in tfjs-node
2023-03-13 14:04:49 -07:00
Matthew Soulanille 130a56d4d8
Add StaticRegexReplace Op (#7379) 2023-02-15 10:57:11 -08:00
Ping Yu f42aba1efb
[tfjs-node] support einsum in tfjs node (#7321)
* support einsum in tfjs node

* Update Einsum.ts

---------

Co-authored-by: Matthew Soulanille <msoulanille@google.com>
2023-01-29 01:33:59 -08:00
Matthew Soulanille c14f877c99
Update TypeScript to 4.9.4 (#7300) 2023-01-28 21:20:56 -08:00
Matthew Soulanille 0a32b672ef
Improve npm publishing infra (#7287)
The current npm publishing infra is more manual than necessary. This PR makes the following improvements:

1. Publish all packages in a release unit with one command. Publishing no longer involves running yarn publish-npm multiple times.

2. Stage all packages to a local verdaccio repository before publishing. This catches any compatibility issues that may appear when publishing to npm and allows us to build all packages before publishing any to npm.

3. Publish with a single OTP. The previous infra required an OTP per package to publish to npm. This new infra publishes all packages sequentially after they're built, so it can use a single OTP for all of them. If another OTP is required due to the first one timing out, it asks for another.

A future PR will move our nightly verdaccio e2e tests to use this infra, which will allow us to avoid setting the npm registry globally. This will let us run verdaccio tests in parallel with the rest of nightly tests, which should reduce the time taken.
2023-01-23 16:27:41 -08:00
dependabot[bot] 897728fd4f
build(deps): bump json5 from 2.2.0 to 2.2.3 in /tfjs-node (#7242)
Bumps [json5](https://github.com/json5/json5) from 2.2.0 to 2.2.3.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v2.2.0...v2.2.3)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-11 10:28:41 -08:00
Ping Yu 9eb0229922
[op] added support for TensorScatterUpdate op (#7189)
FEATURE
* added support for TensorScatterUpdate op

* fix snippet error

* fix license year

* addressed comments
2023-01-04 10:30:32 -08:00
Matthew Soulanille 892b22b463
Do not run docker interactively in tfjs-node publish (#7227) 2023-01-03 16:00:34 -08:00
Linchenn cd8c668a24
Fix avgPool3d (#7133)
BUG

* fix webgl

* rename

* add strides check

* Update conv_util.ts

* reduce valid

* lint

* reduce

* add tests

* isArray

* Update pool_gpu.ts

* Update pool2d_webgpu.ts

* Update avg_pool_3d_test.ts

* Update avg_pool_3d_test.ts

* skip tests for node
2022-12-05 16:54:57 -08:00
Ping Yu ec16c5f7c4
[tfjs-node] replace Exception with Error constructor (#7131)
fixes #7125

Co-authored-by: Matthew Soulanille <msoulanille@google.com>
2022-12-01 12:32:20 -08:00
Matthew Soulanille 087a02a284
Cast to 'unknown' instead of '{}' in double assertions (#7116)
Avoid casting through '{}' with 'foo as {} as Bar' and instead use 'unknown', i.e. 'foo as unknown as Bar'. This is the preferred method according to Google's style guide. Internal link: go/tsstyle#double-assertions.
2022-11-29 10:03:02 -08:00
dependabot[bot] c9a962b1fc
Bump minimatch from 3.0.4 to 3.1.2 in /tfjs-node (#7084)
Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.1.2.
- [Release notes](https://github.com/isaacs/minimatch/releases)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.1.2)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-22 11:27:26 -08:00
Matthew Soulanille 8571f496f1
Upgrade tfjs repo to 4.0.0 (#6927)
This major release upgrades TypeScript from 3.5.3 to 4.8.4 (https://github.com/tensorflow/tfjs/pull/6346). It is intended to be as non-breaking as possible, but it technically has breaking changes for users of `typescript<4.4`. All other users should be unaffected.

When compiling projects that depend on TFJS with `typescript<4.4`, the following error will appear.
```
node_modules/@webgpu/types/dist/index.d.ts:587:16 - error TS2304: Cannot find name 'PredefinedColorSpace'.

587   colorSpace?: PredefinedColorSpace;
                   ~~~~~~~~~~~~~~~~~~~~
...
```
This can be fixed by upgrading TypeScript to 4.4.2 or greater, or by adding the file `predefined_color_space.d.ts` (name and path can be changed) with the following contents to your project to define the missing type. If this file is added, it will need to be removed when TypeScript is upgraded past 4.3.
```typescript
type PredefinedColorSpace = "display-p3" | "srgb";
```

`typescript<3.7` has the following additional error.
```
node_modules/@tensorflow/tfjs-core/dist/engine.d.ts:127:9 - error TS1086: An accessor cannot be declared in an ambient context.

127     get backend(): KernelBackend;
            ~~~~~~~
...
```

Enabling [`skipLibCheck`](https://www.typescriptlang.org/tsconfig#skipLibCheck) suppresses this error, and upgrading to at least TypeScript 3.6.2 fixes it (although the above fix for `PredefinedColorSpace` will also need to be applied).
2022-10-12 14:21:32 -07:00
Matthew Soulanille c2ee7b4dbd
Build tfjs-node node addon with the release docker (#6925)
Build the tfjs-node and tfjs-node-gpu node addons with the release docker image when publishing them to npm. This ensures a consistent GLIBCXX version is used when publishing.
2022-10-11 15:53:59 -07:00
ahmedsabie fd95c22e10
Add kernel RaggedRange for CPU and WebGL backend (#6871)
* Add kernel RaggedRange for CPU and WebGL backend

* Exclude test from tfjs-node

Co-authored-by: Ping Yu <4018+pyu10055@users.noreply.github.com>
2022-10-10 10:30:32 -07:00
Matthew Soulanille c5eb1d39bf
[e2e] Fix incorrect reference to link-package (#6895)
Some package.json files in e2e linked against link_package instead of link-package. This was not discovered earlier because these tests are usually run after the package.jsons are prepared for release and dependencies are rewritten to the release versions.
2022-10-05 09:52:39 -07:00
Matthew Soulanille 18034b0275
Run Verdaccio tests in nightly (#6660)
Currently, we run Verdaccio tests only when we do a release. Since they're only tested after choosing a release commit from nightly CI, they are often a point of failure. This PR makes them run during nightly tests, so we can identify issues with them before creating a release PR.

This PR also enables Bazel sandboxing, which fixes the rules_nodejs linker issue.
2022-10-04 12:14:24 -07:00
ahmedsabie f8dabdb0e7
Add kernel RaggedGather for CPU and WebGL backend (#6765)
* Add kernel RaggedGather for CPU and WebGL backend

* Improve error message

* Mark function as async

* Mark function as async

* Fix expect call for async

* Fix datasync call
2022-09-07 14:55:30 -04:00
Rajeshwar Reddy T 29d9be90bb
[tfjs-node]: upgrade TF to 2.9.1 (#6786)
Fixes #6784
2022-08-24 11:00:05 -07:00
Ping Yu e2b6a9dc97
[op] allow dtype secification for onehot op (#6781)
* allow dtype secification for onehot op

* fix onehot dtype for node.js
2022-08-22 16:11:58 -07:00
ahmedsabie 1eefcce7ae
Add kernel RaggedTensorToTensor for CPU and WebGL backend (#6686)
* Add kernel RaggedTensorToTensor for CPU and WebGL backend

* Add WebGL kernel forward

* Change version
2022-08-04 14:10:39 -04:00
Matthew Soulanille d9f74555f0
Make link-package's build-deps-for script check transitive deps (#6712)
Make build-deps-for check for Bazel dependencies transitively instead of just on the packages passed to it. Additionally, change the behavior of `build-deps-for` so that when it is passed a Bazel package, it will directly build the package instead of building just its dependencies.

Co-authored-by: Linchenn <40653845+Linchenn@users.noreply.github.com>
2022-08-03 11:24:08 -07:00
Ping Yu 61c593b82b
add doc for tfjs-node on mac with m1 (#6630)
DOC
2022-07-18 13:04:29 -07:00
Xu Xing 493945357a
[webgpu] Support convTranspose vec4 (#6603) 2022-07-07 16:35:58 +08:00
Matthew Soulanille 189ac32bca
Update Jasmine from 3.1.0 to 4.2.1 (#6520)
Update jasmine from 3.1.0 to 4.2.1 for Bazel packages. Update karma from 6.3.16 to 6.4.0.

Remove deprecated use of async function and done callback at the same time in Jasmine tests.

Add karma-jasmine-html-reporter to show test status in the browser window.
2022-06-29 16:25:09 -07:00
Matthew Soulanille 466807fb3d
Support Linux arm64 in tfjs-node (#6564)
Bump tfjs-node TensorFlow version from 2.7.0 to 2.7.3.

Add tfjs-node/scripts/build-libtensorflow-arm64.yml, a Google CloudBuild file to cross-compile TF 2.7.3 to arm64 and upload it to GCP.

Add a special case for arm64 like we do for arm32 and darwin arm64.

Fixes #5937

Tested in a Linux docker container running on Apple silicon.
2022-06-23 15:29:02 -07:00
Matthew Soulanille 2745ea9de9
[wasm] Build tfjs-backend-wasm entirely with Bazel (#6458)
Build tfjs-backend-wasm with Bazel. tfjs-backend-wasm already uses Bazel for Emscripten. This PR makes it use Bazel for TypeScript as well and replaces the build scripts with a single pkg_npm target.

Fixes #5282
2022-06-14 10:18:02 -07:00
Linchenn 5d66183c8d
[node] Add broadcasting support for BatchMatMul (#6477)
* Update kernel_names.ts

* Update BUILD

* Update BUILD

* Update BUILD

* upd

* enable tests for batches

* cmt

* Merge branch 'master' into fixbatchMatMul
2022-06-01 16:51:01 -07:00
Ping Yu 7e3c36adec
[secu] update package.json files to resolve security alerts (#6448)
Clean up the package.json files for directories migrated to bazel.
2022-05-25 13:41:56 -07:00
Linchenn 2931945ff4
disable new tests (#6425)
BUG
2022-05-19 11:02:19 -07:00
Linchenn 804e26c306
Support NCHW dataFormat for fusedConv2d (Core) (#6373)
FEATURE 

* basic support and tests

* disable NCHW fusedConv2d for node

* disable NCHW fusedConv2d for WebGPU

* Move tests from WebGL to Core

* disable bias/prelu for CPU fusedConv2d

* tune test filter

* Update conv2d.ts

* fix typo

* move tests

* exclude tests for cpu

* Update setup_test.ts

* typo

* Update fused_conv2d_test.ts

* enable cpu

* lint
2022-05-16 10:42:00 -07:00
Matthew Soulanille f471f97836
Improve link_package speed (#6376)
Improve link_package speed by only building the dependencies that are required and by building them all in a single bazel build command.

Remove the link_package_core package, which is no longer needed now that link_package can build just the required dependencies.
2022-05-10 17:06:05 -07:00