同步操作将从 Gitee 极速下载/TensorFlow.js 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
This repository is a monorepo that contains the following NPM packages:
APIs:
Backends/Platforms:
We use yarn, and if you are adding or removing dependencies you should use yarn
to keep the yarn.lock
file up to date.
We recommend using Visual Studio Code for
development. Make sure to install
TSLint VSCode extension
and the npm clang-format 1.2.2
or later
with the
Clang-Format VSCode extension
for auto-formatting.
Before submitting a pull request, make sure the code passes all the tests and is clean of lint errors:
# cd into the package directory you want to test
$ yarn test
$ yarn lint
This will install yarn dependencies, build the other TensorFlow.js packages that the package being tested depeds on,
and run the tests for the package. During development, you may want to run yarn test-dev
instead to avoid
unnecessarily rebuilding dependencies.
Many TensorFlow.js packages use Karma to run tests in a browser. These tests can be configured by command-line options.
To run a subset of tests:
$ yarn test --//:grep=multinomial
> ...
> Chrome 62.0.3202 (Mac OS X 10.12.6): Executed 28 of 1891 (skipped 1863) SUCCESS (6.914 secs / 0.634 secs)
To run the tests once and exit the karma process (helpful on Windows):
$ yarn test --single-run
To run the tests in an environment that does not have GPU support (such as Chrome Remote Desktop):
$ yarn test --testEnv cpu
Available test environments: cpu, webgl1, webgl2.
In any of the directories the following commands build the NPM tarball:
$ yarn build-npm
> Stored standalone library at dist/tf-core(.min).js
> Stored also tensorflow-tf-core-VERSION.tgz
To install it locally, run yarn add ./tensorflow-tf-core-VERSION.tgz
.
On Windows, use bash (available through git) to use the scripts above.
Looking to contribute, and don't know where to start? Check out our "stat:contributions welcome" issues.
Developing on Windows is supported through the Windows Subsystem for Linux (WSL) running Debian.
sudo apt update && sudo apt install nodejs && npm i -g yarn
.
If you need to reset the root debian password, you can get a root shell from command prompt with wsl -u root
.chrome.exe
. It's probably C:\Program Files\Google\Chrome\Application\chrome.exe
.CHROME_BIN
variable, clone the tfjs
repo, and create a custom .bazelrc.user
config for WSL. If your chrome.exe
is not located at the above path, you will need to change it to the correct path in the command below.# Add yarn bin to the path
echo "export PATH=$PATH:~/.yarn/bin/" >> ~/.bashrc &&
# Set CHROME_BIN. Change this if your CHROME_BIN has a different path.
echo "export CHROME_BIN=/mnt/c/Program\ Files/Google/Chrome/Application/chrome.exe" >> ~/.bashrc &&
source ~/.bashrc &&
# Clone tfjs.
git clone https://github.com/tensorflow/tfjs.git &&
cd tfjs &&
# Create the .bazelrc.user file for WSL.
echo "# Pass necessary WSL variables for running in Windows Subsystem for Linux.
# WSLENV and WSL_DISTRO_NAME are build-in variables that are needed for running
# the 'wslpath' command, which Karma uses to resolve file paths.
# DISPLAY=:0 is passed to the Chrome process to make it launch in a window
# since running Chrome headlessly from WSL does not seem to work. If you get
# this working, please send a PR updating these docs (or open an issue :).
run --test_env=CHROME_BIN --test_env=WSLENV --test_env=WSL_DISTRO_NAME --define DISPLAY=:0
test --test_env=CHROME_BIN --test_env=WSLENV --test_env=WSL_DISTRO_NAME --define DISPLAY=:0" > .bazelrc.user &&
printf "\n\nDone! Try running a browser test to verify the installation worked, e.g. 'cd tfjs-core && yarn && yarn test-browser'\n"
When merging commits into master, it is important to follow a few conventions so that we can automatically generate release notes and have a uniform commit history.
When you squash and merge, the default commit body will be all of the commits on your development branch (not the PR description). These are usually not very useful, so you should remove them, or replace them with the PR description.
Release notes are automatically generated from commits. We have introduced a few tags which help sort commits into categories for release notes:
These tags correspond to GitHub labels which are automatically prepended to your PR description. Please add the appropriate labels to your PR.
A typical commit may look something like:
Subject: Add tf.toPixels. (#900)
Body:
FEATURE
tf.toPixels is the inverse of tf.fromPixels, writing a tensor to a canvas.
This will show up under "Features" as:
You can also use multiple tags for the same commit if you want it to show up in two sections. You can add clarifying text on the line of the tags.
You can add clarifying messages on the line of the tag as well.
For example:
Subject: Improvements to matMul. (#900)
Body:
FEATURE Add transpose bits to matmul.
PERFORMANCE Improve matMul CPU speed by 100%.
This will show up under "Features" as:
This will also show up under "Performance" as:
$ git clone https://github.com/tensorflow/tfjs-core.git
$ cd tfjs-core
$ yarn # Installs dependencies.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。