Skip to content

Commit 9a0bf29

Browse files
authored
Upgrade browser examples to tfjs v1.0.0 (tensorflow#242)
Code changes apart from dependency version upgrades: - In cart-pole: replace `tf.Model` with `tf.LayersModel` - In data-generator, replace `tf.data.generator()` with `tf.data.func()`. Replace the length-2 array with a "dict" with fields 'xs' and 'ys', as per new tf.data API in v1.0.0. Fixes tensorflow/tfjs#1328
1 parent d0a861e commit 9a0bf29

File tree

42 files changed

+456
-1998
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+456
-1998
lines changed

addition-rnn/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ class AdditionRNNDemo {
295295
const accuracyContainer = document.getElementById('accuracyChart');
296296
tfvis.render.linechart(
297297
{values: accuracyValues, series: ['train', 'validation']},
298-
accuracyContainer, {
298+
accuracyContainer,
299+
{
299300
width: 420,
300301
height: 300,
301302
xLabel: 'epoch',

addition-rnn/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"node": ">=8.9.0"
1010
},
1111
"dependencies": {
12-
"@tensorflow/tfjs": "^0.15.3",
12+
"@tensorflow/tfjs": "^1.0.0",
1313
"@tensorflow/tfjs-vis": "^0.4.2"
1414
},
1515
"scripts": {

addition-rnn/yarn.lock

+24-119
Original file line numberDiff line numberDiff line change
@@ -642,90 +642,34 @@
642642
resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b"
643643
integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==
644644

645-
"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2":
646-
version "1.1.2"
647-
resolved "https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf"
648-
integrity sha1-m4sMxmPWaafY9vXQiToU00jzD78=
649-
650-
"@protobufjs/base64@^1.1.2":
651-
version "1.1.2"
652-
resolved "https://registry.yarnpkg.com/@protobufjs/base64/-/base64-1.1.2.tgz#4c85730e59b9a1f1f349047dbf24296034bb2735"
653-
integrity sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==
654-
655-
"@protobufjs/codegen@^2.0.4":
656-
version "2.0.4"
657-
resolved "https://registry.yarnpkg.com/@protobufjs/codegen/-/codegen-2.0.4.tgz#7ef37f0d010fb028ad1ad59722e506d9262815cb"
658-
integrity sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==
659-
660-
"@protobufjs/eventemitter@^1.1.0":
661-
version "1.1.0"
662-
resolved "https://registry.yarnpkg.com/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz#355cbc98bafad5978f9ed095f397621f1d066b70"
663-
integrity sha1-NVy8mLr61ZePntCV85diHx0Ga3A=
664-
665-
"@protobufjs/fetch@^1.1.0":
666-
version "1.1.0"
667-
resolved "https://registry.yarnpkg.com/@protobufjs/fetch/-/fetch-1.1.0.tgz#ba99fb598614af65700c1619ff06d454b0d84c45"
668-
integrity sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=
669-
dependencies:
670-
"@protobufjs/aspromise" "^1.1.1"
671-
"@protobufjs/inquire" "^1.1.0"
672-
673-
"@protobufjs/float@^1.0.2":
674-
version "1.0.2"
675-
resolved "https://registry.yarnpkg.com/@protobufjs/float/-/float-1.0.2.tgz#5e9e1abdcb73fc0a7cb8b291df78c8cbd97b87d1"
676-
integrity sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=
677-
678-
"@protobufjs/inquire@^1.1.0":
679-
version "1.1.0"
680-
resolved "https://registry.yarnpkg.com/@protobufjs/inquire/-/inquire-1.1.0.tgz#ff200e3e7cf2429e2dcafc1140828e8cc638f089"
681-
integrity sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=
682-
683-
"@protobufjs/path@^1.1.2":
684-
version "1.1.2"
685-
resolved "https://registry.yarnpkg.com/@protobufjs/path/-/path-1.1.2.tgz#6cc2b20c5c9ad6ad0dccfd21ca7673d8d7fbf68d"
686-
integrity sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=
687-
688-
"@protobufjs/pool@^1.1.0":
689-
version "1.1.0"
690-
resolved "https://registry.yarnpkg.com/@protobufjs/pool/-/pool-1.1.0.tgz#09fd15f2d6d3abfa9b65bc366506d6ad7846ff54"
691-
integrity sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=
692-
693-
"@protobufjs/utf8@^1.1.0":
694-
version "1.1.0"
695-
resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570"
696-
integrity sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=
697-
698-
"@tensorflow/[email protected]":
699-
version "0.8.4"
700-
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-converter/-/tfjs-converter-0.8.4.tgz#7c1326e9858c6c3a6d23947e31a73e9458450a9b"
701-
integrity sha512-hHTyQiQOeYvFB/zL/jDT51hx+voOoKOVHSAWzPG10G8+H7ljQsRzxj19X/PIk8EUo9TXJT2Aj+/WW0guK+0wJg==
702-
dependencies:
703-
"@types/long" "~3.0.32"
704-
protobufjs "~6.8.6"
645+
"@tensorflow/[email protected]":
646+
version "1.0.0"
647+
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-converter/-/tfjs-converter-1.0.0.tgz#cdd7bbf9f39fde93156fb1bddeac16a8ab157d6d"
648+
integrity sha512-BGiR2U2BEKL+Gwf2Pqu7fZZw+z3ptMORTeS/rIxVnpIbeb7jsD7q25ibvfX1yuk21GM7igfZ53c4FPwqa24G9Q==
705649

706-
"@tensorflow/tfjs-core@0.15.4":
707-
version "0.15.4"
708-
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-0.15.4.tgz#aaf52acd209476ebde7bd9a37a7c60ec9d067b65"
709-
integrity sha512-CWi6PuWOBfFRRzn4gl4rcCtwHkimYexGaQi5rwF2jPntknT8TIhonkacvuBROEfeq2PEvqKzCWJTU5+AmCj2HQ==
650+
"@tensorflow/tfjs-core@1.0.0":
651+
version "1.0.0"
652+
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-core/-/tfjs-core-1.0.0.tgz#1be6240efc5b2f270f90a032713dfac666fa1533"
653+
integrity sha512-YiGjDJODPXI9S9AEizf6rdkYFFFCBCqwOmFqBY2MderPaDJ71rqhTzWQkWCMXV4Jhz5J+TEqtr8ishl3Zyid6A==
710654
dependencies:
711655
"@types/seedrandom" "2.4.27"
712656
"@types/webgl-ext" "0.0.30"
713657
"@types/webgl2" "0.0.4"
714658
seedrandom "2.4.3"
715659

716-
"@tensorflow/tfjs-data@0.2.3":
717-
version "0.2.3"
718-
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-data/-/tfjs-data-0.2.3.tgz#67c0cd505485c9b0b6a83cb1c8a24559c5adfa68"
719-
integrity sha512-U9eDD35i0jFQtbm90XMP+dVEwaE0hCrhbt6OEpDCTYxdCLOMDnKVmx+q2TOoCPvTxToC6jHOMPKXO23bLAJsxw==
660+
"@tensorflow/tfjs-data@1.0.0":
661+
version "1.0.0"
662+
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-data/-/tfjs-data-1.0.0.tgz#ccdc4fe713ca903cdc61135f7c361effaea4e670"
663+
integrity sha512-pWn0OH5x67Qa98FWiBO1UvcglEsDFf57Tv7amtC+WxlMrH5hUHSaR30dBaW1qpdOEJkDRJtUg6tNTG2av6mqVQ==
720664
dependencies:
721665
"@types/node-fetch" "^2.1.2"
722666
node-fetch "~2.1.2"
723667
seedrandom "~2.4.3"
724668

725-
"@tensorflow/tfjs-layers@0.10.3":
726-
version "0.10.3"
727-
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-layers/-/tfjs-layers-0.10.3.tgz#cf4001b5b7566b1526e65e615439e85070a1012c"
728-
integrity sha512-Xhaz4+ZuL2SEm3S0u4x04dMYMrcG4w4dhMOjoQW8GhAJU4p7LkmP9TmwMEHp7CIVJiJzzQy7Hg8E5fESEnJinA==
669+
"@tensorflow/tfjs-layers@1.0.0":
670+
version "1.0.0"
671+
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs-layers/-/tfjs-layers-1.0.0.tgz#e4344e9221001850eb1615184fa5ca2499f75254"
672+
integrity sha512-+RB5TKM/L7qLn17ic8da/G2qg8EFhRvZIoRA6uCCs5OMUJAUQqhDqBNaoWiy0pYtXDzfZJu3ZOkDbAg2Xv2YOQ==
729673

730674
"@tensorflow/tfjs-vis@^0.4.2":
731675
version "0.4.2"
@@ -741,25 +685,15 @@
741685
vega-lib "4.4.0"
742686
vega-lite "3.0.0-rc10"
743687

744-
"@tensorflow/tfjs@^0.15.3":
745-
version "0.15.3"
746-
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs/-/tfjs-0.15.3.tgz#6608833952858c8984f20962eb86624f99196f06"
747-
integrity sha512-NBAs+iGBNBxprm98mk488EfTDl2kA/lzNguoQGEMeIPWVHTbadSn2QV5xXKAf/fcOat+JwVfqe2vxHBbTjHMOw==
688+
"@tensorflow/tfjs@^1.0.0":
689+
version "1.0.0"
690+
resolved "https://registry.yarnpkg.com/@tensorflow/tfjs/-/tfjs-1.0.0.tgz#a4a181c59e1b82ad8b09b5d1da5cafc9a457b83a"
691+
integrity sha512-ZnX4GvIpKBywybBCOXi0ym04LVosJwvZN2hOKatvO6/P1HkOw5Qfu+rwQLuKsZMrcdzJXzNN8L0NiJiPu6AStw==
748692
dependencies:
749-
"@tensorflow/tfjs-converter" "0.8.4"
750-
"@tensorflow/tfjs-core" "0.15.4"
751-
"@tensorflow/tfjs-data" "0.2.3"
752-
"@tensorflow/tfjs-layers" "0.10.3"
753-
754-
"@types/long@^4.0.0":
755-
version "4.0.0"
756-
resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.0.tgz#719551d2352d301ac8b81db732acb6bdc28dbdef"
757-
integrity sha512-1w52Nyx4Gq47uuu0EVcsHBxZFJgurQ+rTKS3qMHxR1GY2T8c2AJYd6vZoZ9q1rupaDjU0yT+Jc2XTyXkjeMA+Q==
758-
759-
"@types/long@~3.0.32":
760-
version "3.0.32"
761-
resolved "https://registry.yarnpkg.com/@types/long/-/long-3.0.32.tgz#f4e5af31e9e9b196d8e5fca8a5e2e20aa3d60b69"
762-
integrity sha512-ZXyOOm83p7X8p3s0IYM3VeueNmHpkk/yMlP8CLeOnEcu6hIwPH7YjZBvhQkR0ZFS2DqZAxKtJ/M5fcuv3OU5BA==
693+
"@tensorflow/tfjs-converter" "1.0.0"
694+
"@tensorflow/tfjs-core" "1.0.0"
695+
"@tensorflow/tfjs-data" "1.0.0"
696+
"@tensorflow/tfjs-layers" "1.0.0"
763697

764698
"@types/node-fetch@^2.1.2":
765699
version "2.1.6"
@@ -773,11 +707,6 @@
773707
resolved "https://registry.yarnpkg.com/@types/node/-/node-11.9.4.tgz#ceb0048a546db453f6248f2d1d95e937a6f00a14"
774708
integrity sha512-Zl8dGvAcEmadgs1tmSPcvwzO1YRsz38bVJQvH1RvRqSR9/5n61Q1ktcDL0ht3FXWR+ZpVmXVwN1LuH4Ax23NsA==
775709

776-
"@types/node@^10.1.0":
777-
version "10.12.26"
778-
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.26.tgz#2dec19f1f7981c95cb54bab8f618ecb5dc983d0e"
779-
integrity sha512-nMRqS+mL1TOnIJrL6LKJcNZPB8V3eTfRo9FQA2b5gDvrHurC8XbSA86KNe0dShlEL7ReWJv/OU9NL7Z0dnqWTg==
780-
781710
"@types/node@^10.11.7":
782711
version "10.12.18"
783712
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.18.tgz#1d3ca764718915584fcd9f6344621b7672665c67"
@@ -3952,11 +3881,6 @@ log-symbols@^2.2.0:
39523881
dependencies:
39533882
chalk "^2.0.1"
39543883

3955-
long@^4.0.0:
3956-
version "4.0.0"
3957-
resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28"
3958-
integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==
3959-
39603884
loose-envify@^1.0.0, loose-envify@^1.3.1:
39613885
version "1.4.0"
39623886
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
@@ -5341,25 +5265,6 @@ proto-list@~1.2.1:
53415265
resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849"
53425266
integrity sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=
53435267

5344-
protobufjs@~6.8.6:
5345-
version "6.8.8"
5346-
resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.8.8.tgz#c8b4f1282fd7a90e6f5b109ed11c84af82908e7c"
5347-
integrity sha512-AAmHtD5pXgZfi7GMpllpO3q1Xw1OYldr+dMUlAnffGTAhqkg72WdmSY71uKBF/JuyiKs8psYbtKrhi0ASCD8qw==
5348-
dependencies:
5349-
"@protobufjs/aspromise" "^1.1.2"
5350-
"@protobufjs/base64" "^1.1.2"
5351-
"@protobufjs/codegen" "^2.0.4"
5352-
"@protobufjs/eventemitter" "^1.1.0"
5353-
"@protobufjs/fetch" "^1.1.0"
5354-
"@protobufjs/float" "^1.0.2"
5355-
"@protobufjs/inquire" "^1.1.0"
5356-
"@protobufjs/path" "^1.1.2"
5357-
"@protobufjs/pool" "^1.1.0"
5358-
"@protobufjs/utf8" "^1.1.0"
5359-
"@types/long" "^4.0.0"
5360-
"@types/node" "^10.1.0"
5361-
long "^4.0.0"
5362-
53635268
pseudomap@^1.0.2:
53645269
version "1.0.2"
53655270
resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"

boston-housing/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"node": ">=8.9.0"
1010
},
1111
"dependencies": {
12-
"@tensorflow/tfjs": "^0.15.3",
12+
"@tensorflow/tfjs": "^1.0.0",
1313
"@tensorflow/tfjs-vis": "^0.4.2",
1414
"papaparse": "^4.5.0"
1515
},

0 commit comments

Comments
 (0)