Commit Graph

83 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
gaikwadrahul8 737b8f1052
Update tar package version for tfjs-node & tfjs-node-gpu (#8280) 2024-05-21 10:09:24 -07: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
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
Matthew Soulanille c14f877c99
Update TypeScript to 4.9.4 (#7300) 2023-01-28 21:20:56 -08:00
dependabot[bot] 40047e0e11
build(deps): bump json5 from 2.2.0 to 2.2.3 in /tfjs-node-gpu (#7243)
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:58 -08:00
dependabot[bot] 0906427b7f
Bump minimatch from 3.0.4 to 3.1.2 in /tfjs-node-gpu (#7085)
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:37 -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 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
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 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
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
Ping Yu 33c62a005c
Security fixes (#6268)
* yarn.lock updates for security warning

* fix minimist security issue
2022-03-29 12:34:26 -07:00
Ping Yu e674862840
yarn.lock updates for security warning (#6229) 2022-03-14 14:44:34 -07:00
Matthew Soulanille 32cacb8f56
Add and update package.json repository metadata (#5887)
Add the "repository" field to packages that were missing it and update the field for packages that were migrated into the monorepo. See #5770 for details on why this is being done.
2021-11-23 13:56:52 -08:00
Jing Jin e2493368f4
[wasm] Fix offset calculation in Conv2DBackpropInput (#5518)
* fix

* fix

* fix

* fix
2021-08-25 10:58:54 -07:00
Rajeshwar Reddy T dde5ac92ee
Update package.json (#5499)
* Update package.json

Fixes https://github.com/tensorflow/tfjs/issues/5492

* Update package.json

* Merge branch 'master' into rthadur-patch-4
2021-08-17 09:58:49 -07:00
Matthew Soulanille e745d42cae
Use Bazel and ts_library to build core and backend-cpu (#5133)
This PR builds tfjs-core and tfjs-backend-cpu using Bazel and makes the build outputs available to the other packages in the monorepo. It also sets up Bazel rules and macros that facilitate converting other packages in the monorepo to Bazel. For more details, see #5133.
2021-07-15 14:50:45 -07:00
Ping Yu 6e0bcb0cf7
uses require instead of enable esmoduleinterop flag (#5074)
BUG
* uses require instead of esmoduleinterop

* fixed lint error

* run chrome webworker test first
2021-05-14 17:33:26 -07:00
ahmedsabie 2f064d4782
Add kernel StringToHashBucketFast for CPU and WebGL backend (#5052)
FEATURE
* Add kernel StringToHashBucketFast for CPU and WebGL backend

* Remove int32 limit

* fix test failure

* fix long package import error

* add lng package to root package.json

* add types/long package

* fixed cpu and webgl test failure

* added esModuleInterop to root tsconfig

* fix tfjs-converter tests

* fix layers build

* fix tfjs rollup

* fix node tsconfig

* fix node tests

Co-authored-by: Ping Yu <4018+pyu10055@users.noreply.github.com>
2021-05-13 10:32:53 -07:00
Ping Yu 9c696dbdd0
update node-pre-gyp package (#5036)
INTERNAL
2021-05-06 10:43:50 -07:00
Matthew Soulanille b0fd0111ac
Generate code coverage reports for packages (#4946)
Add a `yarn coverage` command to packages to generate coverage reports. Coverage is not yet automated in CI.
2021-04-28 14:24:29 -07:00
Ping Yu 894df69251
add 8 supported napi versions (#4991)
BUG
2021-04-26 14:17:19 -07:00
Ping Yu c238c49f70
fix sec vulnerabilities for all packages (#4869)
SECURITY
* fix sec vul for all packages

* fix rn error

* update pkg version

* update deps for automl

* fix lint

* fix node error

* fix karma stuck error for wasm
2021-03-30 15:53:14 -07:00
Hao Yunfei 8b61fd6bb7
[tfjs-node] Make `yarn build` works on Windows (#4849)
* [tfjs-node] Make `yarn build` works on Windows

FEATURE

* Add `yarn` before node-pre-gyp command

This made command node-pre-gyp works on Windows

* Align tfjs-node-gpu package.json with tfjs-node
2021-03-25 08:54:21 -07:00
Yannick Assogba c46b759744
remove modularization helper scripts (#4612)
INTERNAL
2021-01-28 14:43:37 -05:00
Na Li 299ef1b2a1
Remove tfjs-core as tfjs-node(-gpu) dependency (#4590)
DEV
2021-01-25 12:01:46 -08:00
Rajeshwar Reddy T aeeb7d14f7
Update package.json (#4538)
* Update package.json

* Update package.json
2021-01-15 09:48:17 -08:00
Matthew Elliott Soulanille e6434f8c0b
Run ts-node tests with --transpile-only to increase speed (#4272)
* Run ts-node tests with --transpile-only to increase speed

* Run 'yarn build' before testing with ts-node

* [cpu] Move run_tests.ts to /src so it is typechecked

* [union] Run test-tools with typechecking

* Remove old tfjs-node integration tests

* Add test-dev to packages that use ts-node

* [core] Remove dependency on union that was added earlier in this PR

* Add a  command to each package

* Remove --transpile-only flag from targets that never run through tsc
2020-12-08 10:39:56 -08:00
Ping Yu 2c6621c721
make sure node 14.x are supported on win32 (#4294)
BUG
Co-authored-by: Ping Yu <piyu@ad.corp.google.com>
2020-11-23 10:26:44 -08:00
Matthew Elliott Soulanille 7bd157e2c2
[Fixed] Run CI on a single machine by generating cloudbuild files (#4186)
* Run CI on a single machine by generating cloudbuild files

Instead of running each CI test on a separate Google Cloud machine, generate a cloudbuild.yml file to test all affected packages on a single machine. The benifits of this strategy include the following:
* Fewer machines are required for a single test (2 instead of up to 12), so queuing should happen much less often.
* Packages only need to be built once, instead of once per machine.
* Multithreaded steps have access to more cores.

When CI is run, the root cloudbuild.yml is launched on Google Cloud. This file has only three steps: Install yarn dependencies, run `yarn generate-cloudbuild-for-packages`, and run `run-build.sh`. The second step finds what packages were affected by the change and combines their cloudbuild.yml files into a single `cloudbuild_generated.yml` file, and the third step launches the generated build on Google Cloud. The steps in the generated build are set to `waitFor` each other according to the dependency tree `scripts/package_dependencies.json`, and each package's `build-deps` step is removed in favor of waiting for its dependencies to be built.

Each package's cloudbuild file still works as expected, and there are two new yarn commands at the root:
* `yarn test-packages` tests all packages affected by a change. It performs the same steps as CI.
* `yarn generate-cloudbuild-for-packages [PACKAGE]...` generates the cloudbuild file to test each `PACKAGE` and packages it might affect. If given no packages, it detects what packages have been changed in the current PR.

* Verify the dependency graph is a valid graph

* Add dependencies to e2e

* Use the node:12 docker image for tfjs-node CI

tfjs-node builds N-API bindings that end-to-end tests need to use. End-to-end uses our custom docker image (gcr.io/learnjs-174218/release) since it has to build tfjs-backend-wasm when it's run by itself (which requires emscripten). Our custom image uses node 12, and is incompatible with node 10 N-API bindings. Eventually, we'll want to move everything that's using node:10 to node:12, but that's out of the scope of this commit.

* Remove TODO and allow changes to generate_cloudbuild.js to trigger a full rebuild

* Add tfjs-backend-cpu to tfjs-data in package_dependencies.json

tfjs-backend-cpu is listed in tfjs-data's package.json as a linked dependency, but was missing form package_dependencies.json.

* Don't have tfjs-backend-webgpu build its dependencies in CI

Move tfjs-backend-webgpu's dependency building to the 'build-deps' step so it can be removed during CI.

This commit also updates the test cloudbuild files that should have been updated in f9c1fdd814. It would probably be best to amend that commit, but last time I tried force-pushing in GitHub, I broke the PR I was working on.

* Revert changes in tfjs-backend-webgpu to master

tfjs-backend-webgpu is now pinned at v2.7.0 for all its tfjs dependencies.

* Add the update-cloudbuild-tests script to package.json

update-cloudbuild-tests updates the change detection tests for scripts/generate_cloudbuild.js. It should be run iff a change affects cloudbuild files or the dependency tree.

* Make tfjs-backend-webgpu tests wait for yarn to run

* Add a destination argument to generate_cloudbuild_for_packages.js

Co-authored-by: Ping Yu <4018+pyu10055@users.noreply.github.com>
2020-11-10 14:10:40 -05:00
Na Li e285254f34
Revert "Run CI on a single machine by generating cloudbuild files. (#4147)" (#4163)
This reverts commit cfa756f814.
2020-10-30 13:41:54 -07:00
Matthew Elliott Soulanille cfa756f814
Run CI on a single machine by generating cloudbuild files. (#4147)
FEATURE
INTERNAL
* Run CI on a single machine by generating cloudbuild files.

Instead of running each CI test on a separate Google Cloud machine, generate a cloudbuild.yml file to test all affected packages on a single machine. The benifits of this strategy include the following:
* Fewer machines are required for a single test (2 instead of up to 12), so less queueing is required.
* Packages only need to be built once, instead of once per machine.
* Multithreaded steps have access to more cores.

When CI is run, the root cloudbuild.yml is launched on Google Cloud. This file has only two steps: Install yarn dependencies and run `yarn test-affected-packages`. The latter step finds what packages were affected by the change and combines their cloudbuild.yml files into a single `cloudbuild_generated.yml` file. The steps in this file are set to `waitFor` each other according to the dependency tree `scripts/package_dependencies.json`, and each package's `build-deps` step is removed in favor of waiting for its dependencies to be built.

Each package's cloudbuild file still works as expected, and there are a few new yarn commands at the root:
`yarn test-packages` tests all packages affected by a change. It's run during CI.
`yarn test-packages [PACKAGE]...` tests a given set of packages, including all packages they might affect if changed.

* Split generating the cloudbuild from running it

Google Cloud uses a separate image for node and for spawning more gcloud instances. The node image does not have the gcloud command, so we have to generate the cloudbuild file in one step and launch gcloud in another step.

Also fix the `rm` command in find_packages_with_diff.js to remove recursively.

* Add `yarn` to the `waitFor` field of webgpu tests

* Modularize Sum and Softmax. (#4148)

DEV

* Lint files

* Fix package dependencies for inference and vis

* Run CI on a single machine by generating cloudbuild files.

Instead of running each CI test on a separate Google Cloud machine, generate a cloudbuild.yml file to test all affected packages on a single machine. The benifits of this strategy include the following:
* Fewer machines are required for a single test (2 instead of up to 12), so less queueing is required.
* Packages only need to be built once, instead of once per machine.
* Multithreaded steps have access to more cores.

When CI is run, the root cloudbuild.yml is launched on Google Cloud. This file has only two steps: Install yarn dependencies and run `yarn test-affected-packages`. The latter step finds what packages were affected by the change and combines their cloudbuild.yml files into a single `cloudbuild_generated.yml` file. The steps in this file are set to `waitFor` each other according to the dependency tree `scripts/package_dependencies.json`, and each package's `build-deps` step is removed in favor of waiting for its dependencies to be built.

Each package's cloudbuild file still works as expected, and there are a few new yarn commands at the root:
`yarn test-packages` tests all packages affected by a change. It's run during CI.
`yarn test-packages [PACKAGE]...` tests a given set of packages, including all packages they might affect if changed.

* Split generating the cloudbuild from running it

Google Cloud uses a separate image for node and for spawning more gcloud instances. The node image does not have the gcloud command, so we have to generate the cloudbuild file in one step and launch gcloud in another step.

Also fix the `rm` command in find_packages_with_diff.js to remove recursively.

* Add `yarn` to the `waitFor` field of webgpu tests

* Lint files

* Fix package dependencies for inference and vis

* modularize node kernels (#4154)

Modularizes onesLike, zerosLike, unpack/unstack, batchMatMul, slice, isFinite, isInf, IsNan, reciprocal, squaredDifference

DEV

* Enable incremental typescript builds (#4092)

FEATURE
INTERNAL
Enable incremental builds in the root tsconfig.json to increase build speed during development. For example, running `yarn build` in tfjs-backend-cpu takes ~43 seconds without incremental builds and ~30 seconds with incremental builds (after the first build).

Co-authored-by: Ping Yu <4018+pyu10055@users.noreply.github.com>

* Fix typo in .github/stale.yml (#3642)

INTERNAL

* Address some of the comments

* Re-lint everything with VSCode.
* Hoist consts and use UPPER_SNAKE_CASE.
* Require each step to have an id and add ids to all steps in converter and vis.
* Use argparse for 'generate_cloudbuild_for_packages.js'

* Remove inference, vis, and react-native dependencies in package_dependencies.json

tfjs-inference, vis, and react-native use pinned versions of other tfjs packages, so they do not need to be tested when those pinned packages change.

* Fix generate_cloudbuild_for_packages

generate_cloudbuild_for_packages.js was using argparse functions from a later version of argparse that are not available in 1.0.10.

* [webgl] Modularize batchMatMul, sum. (#4140)

FEATURE

* Add Prod kernel to WASM backend. (#4138)

FEATURE
Co-authored-by: Ann Yuan <annyuan@gmail.com>

* Write tests for generate_cloudbuild.js

Write tests to detect if generate_cloudbuild's output changes. These tests are not unit tests, but they alert us if a change unexpectedly changes the project structure or the generation of cloudbuild files.

* Run CI on a single machine by generating cloudbuild files.

Instead of running each CI test on a separate Google Cloud machine, generate a cloudbuild.yml file to test all affected packages on a single machine. The benifits of this strategy include the following:
* Fewer machines are required for a single test (2 instead of up to 12), so less queueing is required.
* Packages only need to be built once, instead of once per machine.
* Multithreaded steps have access to more cores.

When CI is run, the root cloudbuild.yml is launched on Google Cloud. This file has only two steps: Install yarn dependencies and run `yarn test-affected-packages`. The latter step finds what packages were affected by the change and combines their cloudbuild.yml files into a single `cloudbuild_generated.yml` file. The steps in this file are set to `waitFor` each other according to the dependency tree `scripts/package_dependencies.json`, and each package's `build-deps` step is removed in favor of waiting for its dependencies to be built.

Each package's cloudbuild file still works as expected, and there are a few new yarn commands at the root:
`yarn test-packages` tests all packages affected by a change. It's run during CI.
`yarn test-packages [PACKAGE]...` tests a given set of packages, including all packages they might affect if changed.

* Split generating the cloudbuild from running it

Google Cloud uses a separate image for node and for spawning more gcloud instances. The node image does not have the gcloud command, so we have to generate the cloudbuild file in one step and launch gcloud in another step.

Also fix the `rm` command in find_packages_with_diff.js to remove recursively.

* Add `yarn` to the `waitFor` field of webgpu tests

* Lint files

* Fix package dependencies for inference and vis

* Address some of the comments

* Re-lint everything with VSCode.
* Hoist consts and use UPPER_SNAKE_CASE.
* Require each step to have an id and add ids to all steps in converter and vis.
* Use argparse for 'generate_cloudbuild_for_packages.js'

* Remove inference, vis, and react-native dependencies in package_dependencies.json

tfjs-inference, vis, and react-native use pinned versions of other tfjs packages, so they do not need to be tested when those pinned packages change.

* Fix generate_cloudbuild_for_packages

generate_cloudbuild_for_packages.js was using argparse functions from a later version of argparse that are not available in 1.0.10.

* Write tests for generate_cloudbuild.js

Write tests to detect if generate_cloudbuild's output changes. These tests are not unit tests, but they alert us if a change unexpectedly changes the project structure or the generation of cloudbuild files.

Co-authored-by: Na Li <linazhao@google.com>
Co-authored-by: Yannick Assogba <yassogba@google.com>
Co-authored-by: Ping Yu <4018+pyu10055@users.noreply.github.com>
Co-authored-by: Rajeshwar Reddy T <43972606+rthadur@users.noreply.github.com>
Co-authored-by: Ann Yuan <annyuan@gmail.com>
Co-authored-by: miaowzhang <miaowzhang@gmail.com>
2020-10-29 19:49:55 -07:00
Yannick Assogba df306ac452
Modularize Greater, GreaterEqual, Less, LessEqual, ... (#4106)
Modularize Greater, GreaterEqual, Less, LessEqual, LogicalAnd, LogicalNot, LogicalOr, Max (#4106)

DEV
2020-10-22 20:59:51 -04:00
Na Li faeb3883ce
Speed up builds. (#4072) 2020-10-14 15:45:15 -07:00
Ping Yu 835faebdd2
support int64 dtype for saved model execution (#4008)
FEATURE
BUG
* support int64 dtype for saved model execution

* fix test

* addressed comments
2020-10-01 20:48:10 -07:00
Ping Yu 5e2d3f6151
support uint8 input for saved model execution (#3974)
FEATURE
* support uint8 input for saved model execution

* add model to tfjs-node-gpu
2020-09-27 07:42:43 -07:00
Yannick Assogba aecaf8d716
update node fetch version (#3971)
SECURITY
2020-09-25 09:48:28 -04:00
Na Li 69dfce1f98
Update License (#3507)
DOC
DOC
* Update license.

* Update license.

* Update license.
2020-06-24 17:37:02 -07:00
Na Li 895ca5db9c
Fix node and nodegpu build. (#3248)
BUG
2020-05-11 18:39:18 -07:00
Kangyi Zhang b25deaa431
Add support for napi version 6 (#3242)
DEV Add support for napi version 6.
2020-05-10 22:51:20 -07:00
Yannick Assogba 1ea245d397
Fix webgl bundling and test invocation
Fixes webgl bundling of imports from CPu backend
Fixes test invocation when dependencies are pinned versions.

INTERNAL
2020-05-08 11:46:14 -04:00
Yannick Assogba 5c4f1f8ab8
Add exported symbols back to webgl backend
Update the release script and prep for tfjs-react-native update to next RC
Update the webgl rollup config to make cpu backend an external

INTERNAL
2020-05-04 18:54:11 -04:00
Na Li acfa7f7305
Remove unnecessary integration tests in node and node-gpu. (#3094) 2020-04-27 15:20:20 -07:00
Yannick Assogba 8c59e2b43a
Update packages to compile to ESM modules by default (#3112)
BREAKING
INTERNAL
2020-04-27 13:29:25 -04:00
Kangyi Zhang 83bb618af7
update yarn.lock (#3090)
DEV
2020-04-16 15:41:46 -07:00
Na Li c7b64f6760
Refactor CI flow. (#3081)
DEV Refactor CI flow.
2020-04-16 12:03:13 -07:00
Na Li 297cb8b36b
Remove layers symlink in node-gpu. (#3031) 2020-04-03 15:40:02 -07:00
Na Li b3f17bb7d5
Remove master branch version update. (#2958) 2020-03-24 13:09:03 -07:00