Skip to content

Update #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
Jul 2, 2019
Merged

Update #2

merged 27 commits into from
Jul 2, 2019

Conversation

WenheLI
Copy link
Owner

@WenheLI WenheLI commented Jul 2, 2019

To see the logs from the Cloud Build CI, please join either
our discussion
or announcement mailing list.

tafsiri and others added 27 commits June 17, 2019 11:22
DEV

This makes the directory structure align with the NPM package structure more closely.

This has the added effect of making syncing to google3 much saner (one BUILD rule for each of the top-level NPM packages).
FEATURE

- Add support for deserializing weights of dtype `string`
- Allow string tensors in `tile` and `expandDims` ops (these ops are used by AutoML)
- Add utf-8 encoding/decoding capability to `Platform`

This is needed to enable execution of AutoML models, which store the vocab as a weight (`Const` tensor) of dtype `string`.

Corresponding change in tfjs-converter: tensorflow/tfjs-converter#386
…1803)

* Fix trainingConfig typing & export

* Save

* Revise fromMemory() for trainingConfig
DEV

This is so that we can sync to google3.

We don't yet update the typescript version compiled here since google3 is not 3.5.2 yet.

Once google3 moves to 3.5.2 so will we.
* Only cleanup canvas if it exists.

This helps for platforms using the WebGL env without actually having a
DOM canvas to use. Offscreen usage will fail on unit tests without this
check on this.canvas.

* Equality check fix.

* One more fix.
Converter fails because it includes it's own scripts in its build process (this is a separate issue I will fix).

I didn't call build-npm because it calls rollup which will slow down the integration tests.

DEV
FEATURE

To align with TensorFlow Python/C++, this PR changes the way we serialize strings in the weights format, and in our engine.

- We store the underlying encoded string bytes as `Uint8Array`. Thus a string tensors (which has multiple strings) is backed by `Uint8Array[]`.
- To keep backwards compatibility, `tensor.data()` returns `string[]`, which means that we try to utf-8 decode a string.
- In the weights format, string bytes are kept unchanged, with their original encoding. Each string is prefixed with 4 bytes denoting the number of bytes in the string. Thus, a string tensor of 3 values will be encoded as
`[4 bytes][string1...][4 bytes][string2...][4 bytes][string3....]`
- Add `util.encodeString(text: string, encoding?: string)` and `util.decodeString(bytes: Uint8Array, encoding?: string)`, along with the respective `Platform` methods
- Add `tensor.bytes()` which gives the underlying bytes of the data - `Uint8Array` for any numeric tensor, and `Uint8Array[]` for string tensors.

Corresponding change in tfjs-converter: tensorflow/tfjs-converter#386
DEV

Adding browser.crypto: false to package.json results in not including crypto and it's dependencies when using `browserify` and `parcel` as bundlers for an end application.

Test used:
I made a hello-world js application that depends on tfjs-core.
Expected my bundle to be ~500kb, but I got 810kb. This fixed the issue
FEATURE

Add fromPixels support for webworker
@WenheLI WenheLI merged commit 385df64 into WenheLI:master Jul 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants