From 9d1d224caf9f936e0ace0ee5854caefb660800f2 Mon Sep 17 00:00:00 2001
From: Daniel Smilkov
Date: Thu, 3 Aug 2017 13:45:13 -0400
Subject: [PATCH] initial commit
---
.gitignore | 5 +
.npmignore | 9 +
.npmrc | 1 +
.vscode/settings.json | 15 +
.vscode/tasks.json | 16 +
CONTRIBUTING.md | 26 +
LICENSE | 202 +
README.md | 100 +
bower.json | 38 +
demos/adder/adder.ts | 71 +
demos/adder/index.html | 34 +
demos/benchmarks/benchmark-demo.html | 49 +
demos/benchmarks/benchmark.ts | 40 +
demos/benchmarks/bundle.js | 3788 +++++++
demos/benchmarks/conv_gpu_benchmark.ts | 90 +
.../conv_transpose_gpu_benchmark.ts | 85 +
demos/benchmarks/logsumexp_cpu_benchmark.ts | 32 +
demos/benchmarks/logsumexp_gpu_benchmark.ts | 51 +
demos/benchmarks/math-benchmark-run-groups.ts | 79 +
demos/benchmarks/math-benchmark.html | 95 +
demos/benchmarks/math-benchmark.ts | 225 +
.../max_pool_backprop_gpu_benchmark.ts | 82 +
demos/benchmarks/max_pool_gpu_benchmark.ts | 121 +
demos/benchmarks/mulmat_cpu_benchmark.ts | 37 +
demos/benchmarks/mulmat_gpu_benchmark.ts | 98 +
demos/benchmarks/tex_util_benchmark.ts | 80 +
demos/chartjs.d.ts | 448 +
demos/deeplearnjs.ts | 18 +
demos/demo-footer.html | 56 +
demos/demo-footer.ts | 15 +
demos/demo-header.html | 48 +
demos/demo-header.ts | 15 +
demos/font-embedding/bundle.js | 8217 ++++++++++++++
demos/homepage/Gemfile | 26 +
demos/homepage/Gemfile.lock | 205 +
demos/homepage/_config.yml | 32 +
demos/homepage/_includes/footer.html | 32 +
demos/homepage/_includes/header.html | 31 +
demos/homepage/_layouts/default.html | 36 +
demos/homepage/_layouts/page.html | 30 +
demos/homepage/assets/style.css | 280 +
demos/homepage/bundle.js | 8216 ++++++++++++++
demos/homepage/index.md | 256 +
demos/homepage/index.ts | 150 +
demos/imagenet/bundle.js | 9296 ++++++++++++++++
demos/imagenet/imagenet-demo.html | 49 +
demos/imagenet/imagenet-demo.ts | 220 +
demos/imagenet/imagenet.html | 114 +
demos/imagenet/images/beerbottle.jpg | Bin 0 -> 4257 bytes
demos/imagenet/images/cat.jpg | Bin 0 -> 24557 bytes
demos/imagenet/images/dog1.jpg | Bin 0 -> 12279 bytes
demos/imagenet/images/dog2.jpg | Bin 0 -> 14872 bytes
demos/imagenet/images/piano.jpg | Bin 0 -> 10271 bytes
demos/imagenet/images/saxophone.jpg | Bin 0 -> 5423 bytes
demos/images/benchmark.png | Bin 0 -> 47293 bytes
demos/images/font-embedding.png | Bin 0 -> 57566 bytes
demos/images/imagenet.png | Bin 0 -> 417161 bytes
demos/images/model-builder.png | Bin 0 -> 100516 bytes
demos/images/nn-art.png | Bin 0 -> 96832 bytes
demos/images/paint-image.png | Bin 0 -> 457134 bytes
demos/mnist/fully_connected_feed.py | 253 +
demos/mnist/hidden1_biases | 3 +
demos/mnist/hidden1_weights | Bin 0 -> 401408 bytes
demos/mnist/hidden2_biases | 1 +
demos/mnist/hidden2_weights | Bin 0 -> 16384 bytes
demos/mnist/index.html | 3 +
demos/mnist/manifest.json | 41 +
demos/mnist/mnist.md | 125 +
demos/mnist/mnist.ts | 139 +
demos/mnist/sample_data.json | 1 +
demos/mnist/softmax_linear_biases | 1 +
demos/mnist/softmax_linear_weights | Bin 0 -> 1280 bytes
demos/model-builder/bundle.js | 9461 +++++++++++++++++
demos/model-builder/cifar10-conv.json | 1 +
demos/model-builder/layer_builder.ts | 370 +
demos/model-builder/mnist-conv.json | 1 +
.../model-builder/mnist-fully-connected.json | 1 +
.../model-builder-datasets-config.json | 43 +
demos/model-builder/model-builder-demo.html | 55 +
demos/model-builder/model-builder.html | 345 +
demos/model-builder/model-builder.ts | 839 ++
demos/model-builder/model-layer.html | 135 +
demos/model-builder/model-layer.ts | 190 +
demos/model-builder/model_builder_util.ts | 18 +
demos/model-builder/tensorflow.ts | 200 +
demos/models/imagenet_classes.ts | 1034 ++
demos/models/imagenet_util.ts | 160 +
demos/models/squeezenet.ts | 191 +
demos/ndarray-image-visualizer.html | 25 +
demos/ndarray-image-visualizer.ts | 90 +
demos/ndarray-logits-visualizer.html | 45 +
demos/ndarray-logits-visualizer.ts | 98 +
demos/nn-art/bundle.js | 8264 ++++++++++++++
demos/nn-art/cppn.ts | 186 +
demos/nn-art/nn-art-demo.html | 55 +
demos/nn-art/nn-art.html | 97 +
demos/nn-art/nn-art.ts | 126 +
demos/nn-art/nn_art_util.ts | 179 +
demos/one_plus_one/index.html | 22 +
demos/one_plus_one/one_plus_one.ts | 52 +
demos/paint-image/bundle.js | 8333 +++++++++++++++
demos/polymer-spec.ts | 64 +
demos/xhr-dataset.ts | 195 +
docs/roadmap.md | 72 +
docs/tutorials/index.md | 24 +
docs/tutorials/intro.md | 310 +
docs/tutorials/ml_beginners.md | 303 +
karma.conf.js | 31 +
package.json | 35 +
scripts/build-demo | 28 +
scripts/build-npm.sh | 20 +
scripts/build-standalone.sh | 18 +
scripts/convert_uint8_tensor_to_png.py | 63 +
scripts/deploy-demo | 36 +
scripts/dump_checkpoint_vars.py | 100 +
scripts/make-website.sh | 53 +
scripts/watch-demo | 33 +
src/checkpoint_loader.ts | 137 +
src/checkpoint_loader_test.ts | 99 +
src/dataset.ts | 266 +
src/dataset_test.ts | 100 +
src/graph.ts | 905 ++
src/graph_layers.ts | 51 +
src/graph_runner.ts | 357 +
src/graph_runner_test.ts | 204 +
src/graph_test.ts | 621 ++
src/graph_util.ts | 132 +
src/graph_util_test.ts | 225 +
src/index.ts | 37 +
src/initializers.ts | 125 +
src/input_provider.ts | 169 +
src/input_provider_test.ts | 140 +
src/math/activation_functions.ts | 84 +
src/math/activation_functions_test.ts | 97 +
src/math/concat3d_util.ts | 49 +
src/math/concat3d_util_test.ts | 66 +
src/math/conv_util.ts | 73 +
src/math/copy2d_util.ts | 27 +
src/math/cost_functions.ts | 49 +
src/math/cost_functions_test.ts | 49 +
src/math/math.ts | 1065 ++
src/math/math_cpu.ts | 898 ++
src/math/math_cpu_test.ts | 1550 +++
src/math/math_gpu.ts | 1303 +++
src/math/math_gpu_test.ts | 2134 ++++
src/math/ndarray.ts | 569 +
src/math/ndarray_test.ts | 338 +
src/math/webgl/addscaledmat_gpu.ts | 84 +
src/math/webgl/addscaledmat_gpu_test.ts | 75 +
src/math/webgl/addsubmuldiv_gpu.ts | 116 +
src/math/webgl/addsubmuldiv_gpu_test.ts | 214 +
src/math/webgl/argmaxequals_gpu.ts | 62 +
src/math/webgl/argmaxequals_gpu_test.ts | 63 +
src/math/webgl/argminmax_gpu.ts | 90 +
src/math/webgl/argminmax_gpu_test.ts | 119 +
src/math/webgl/avg_pool_gpu.ts | 30 +
src/math/webgl/avg_pool_gpu_test.ts | 112 +
src/math/webgl/batchnorm_gpu.ts | 131 +
src/math/webgl/batchnorm_gpu_test.ts | 217 +
src/math/webgl/binaryop_gpu.ts | 78 +
src/math/webgl/concat3d_gpu.ts | 74 +
src/math/webgl/concat3d_gpu_test.ts | 105 +
src/math/webgl/conv_backprop_gpu.ts | 252 +
.../webgl/conv_backprop_gpu_derbias_test.ts | 74 +
.../conv_backprop_gpu_derweights_test.ts | 120 +
.../webgl/conv_backprop_transpose_gpu_test.ts | 144 +
src/math/webgl/conv_gpu.ts | 151 +
src/math/webgl/conv_gpu_getbiasvalue_test.ts | 85 +
.../conv_gpu_getmatrixvalueorzeropad_test.ts | 139 +
src/math/webgl/conv_gpu_test.ts | 413 +
src/math/webgl/copy_gpu.ts | 63 +
src/math/webgl/copy_gpu_test.ts | 189 +
src/math/webgl/exp_gpu.ts | 36 +
src/math/webgl/exp_gpu_test.ts | 49 +
src/math/webgl/gpgpu_context.ts | 310 +
src/math/webgl/gpgpu_context_test.ts | 421 +
src/math/webgl/gpgpu_util.ts | 258 +
src/math/webgl/gpgpu_util_test.ts | 117 +
src/math/webgl/log_gpu.ts | 36 +
src/math/webgl/log_gpu_test.ts | 50 +
src/math/webgl/logsumexp_gpu.ts | 73 +
src/math/webgl/logsumexp_gpu_test.ts | 54 +
src/math/webgl/max_pool_backprop_gpu.ts | 101 +
src/math/webgl/max_pool_backprop_gpu_test.ts | 141 +
src/math/webgl/max_pool_gpu.ts | 44 +
src/math/webgl/max_pool_gpu_test.ts | 114 +
src/math/webgl/max_pool_positions_gpu_test.ts | 110 +
src/math/webgl/min_pool_gpu.ts | 30 +
src/math/webgl/min_pool_gpu_test.ts | 112 +
src/math/webgl/minmax_gpu.ts | 66 +
src/math/webgl/minmax_gpu_test.ts | 103 +
src/math/webgl/mulbcast_gpu.ts | 90 +
src/math/webgl/mulbcast_gpu_test.ts | 140 +
src/math/webgl/mulmat_gpu.ts | 62 +
src/math/webgl/mulmat_gpu_test.ts | 382 +
src/math/webgl/mulmat_packed_gpu.ts | 130 +
src/math/webgl/mulmat_packed_gpu_test.ts | 404 +
src/math/webgl/neg_gpu.ts | 36 +
src/math/webgl/neg_gpu_test.ts | 50 +
src/math/webgl/pool_gpu.ts | 121 +
src/math/webgl/reducesum_gpu.ts | 63 +
src/math/webgl/reducesum_gpu_test.ts | 65 +
src/math/webgl/relu_gpu.ts | 39 +
src/math/webgl/relu_gpu_test.ts | 57 +
src/math/webgl/render_ndarray_gpu_util.ts | 59 +
.../webgl/render_ndarray_gpu_util_test.ts | 70 +
src/math/webgl/reshape_gpu.ts | 65 +
src/math/webgl/reshape_gpu_test.ts | 88 +
src/math/webgl/resize_bilinear_gpu.ts | 92 +
src/math/webgl/resize_bilinear_gpu_test.ts | 127 +
src/math/webgl/shader_compiler.ts | 126 +
src/math/webgl/sigmoid_gpu.ts | 37 +
src/math/webgl/sigmoid_gpu_test.ts | 38 +
src/math/webgl/step_gpu.ts | 39 +
src/math/webgl/step_gpu_test.ts | 65 +
src/math/webgl/tex_util.ts | 233 +
src/math/webgl/tex_util_test.ts | 301 +
src/math/webgl/texture_manager.ts | 92 +
src/math/webgl/trig_gpu.ts | 66 +
src/math/webgl/trig_gpu_test.ts | 57 +
src/math/webgl/unaryop_gpu.ts | 55 +
src/math/webgl/webgl_util.ts | 418 +
src/operation_emitter.ts | 125 +
src/ops/add.ts | 102 +
src/ops/add_test.ts | 193 +
src/ops/argmax.ts | 47 +
src/ops/argmax_test.ts | 67 +
src/ops/argmaxequals.ts | 50 +
src/ops/argmaxequals_test.ts | 80 +
src/ops/concat3d.ts | 57 +
src/ops/concat3d_test.ts | 115 +
src/ops/convolution.ts | 100 +
src/ops/convolution_test.ts | 352 +
src/ops/divide.ts | 114 +
src/ops/divide_test.ts | 158 +
src/ops/element_wise_activation.ts | 93 +
src/ops/element_wise_activation_test.ts | 145 +
src/ops/element_wise_cost.ts | 80 +
src/ops/element_wise_cost_test.ts | 73 +
src/ops/exp.ts | 56 +
src/ops/exp_test.ts | 74 +
src/ops/linear_combination.ts | 83 +
src/ops/linear_combination_test.ts | 99 +
src/ops/log.ts | 56 +
src/ops/log_test.ts | 74 +
src/ops/matmul.ts | 93 +
src/ops/matmul_test.ts | 204 +
src/ops/max_pool.ts | 72 +
src/ops/max_pool_test.ts | 158 +
src/ops/multiply.ts | 99 +
src/ops/multiply_test.ts | 150 +
src/ops/op.ts | 35 +
src/ops/reduce_sum.ts | 62 +
src/ops/reduce_sum_test.ts | 79 +
src/ops/reshape.ts | 53 +
src/ops/softmax.ts | 99 +
src/ops/softmax_test.ts | 79 +
src/ops/split.ts | 62 +
src/ops/split_test.ts | 76 +
src/ops/subtract.ts | 102 +
src/ops/subtract_test.ts | 197 +
src/optimizer.ts | 47 +
src/priority_queue.ts | 223 +
src/priority_queue_test.ts | 199 +
src/session.ts | 285 +
src/session_test.ts | 314 +
src/session_util.ts | 304 +
src/session_util_test.ts | 464 +
src/sgd_optimizer.ts | 93 +
src/tensor_array_map.ts | 107 +
src/tensor_array_map_test.ts | 108 +
src/test_util.ts | 92 +
src/util.ts | 182 +
src/util_test.ts | 89 +
tsconfig-doc.json | 31 +
tsconfig.json | 13 +
tslint.json | 55 +
277 files changed, 93457 insertions(+)
create mode 100644 .gitignore
create mode 100644 .npmignore
create mode 100644 .npmrc
create mode 100644 .vscode/settings.json
create mode 100644 .vscode/tasks.json
create mode 100644 CONTRIBUTING.md
create mode 100644 LICENSE
create mode 100644 README.md
create mode 100644 bower.json
create mode 100644 demos/adder/adder.ts
create mode 100644 demos/adder/index.html
create mode 100644 demos/benchmarks/benchmark-demo.html
create mode 100644 demos/benchmarks/benchmark.ts
create mode 100644 demos/benchmarks/bundle.js
create mode 100644 demos/benchmarks/conv_gpu_benchmark.ts
create mode 100644 demos/benchmarks/conv_transpose_gpu_benchmark.ts
create mode 100644 demos/benchmarks/logsumexp_cpu_benchmark.ts
create mode 100644 demos/benchmarks/logsumexp_gpu_benchmark.ts
create mode 100644 demos/benchmarks/math-benchmark-run-groups.ts
create mode 100644 demos/benchmarks/math-benchmark.html
create mode 100644 demos/benchmarks/math-benchmark.ts
create mode 100644 demos/benchmarks/max_pool_backprop_gpu_benchmark.ts
create mode 100644 demos/benchmarks/max_pool_gpu_benchmark.ts
create mode 100644 demos/benchmarks/mulmat_cpu_benchmark.ts
create mode 100644 demos/benchmarks/mulmat_gpu_benchmark.ts
create mode 100644 demos/benchmarks/tex_util_benchmark.ts
create mode 100644 demos/chartjs.d.ts
create mode 100644 demos/deeplearnjs.ts
create mode 100644 demos/demo-footer.html
create mode 100644 demos/demo-footer.ts
create mode 100644 demos/demo-header.html
create mode 100644 demos/demo-header.ts
create mode 100644 demos/font-embedding/bundle.js
create mode 100644 demos/homepage/Gemfile
create mode 100644 demos/homepage/Gemfile.lock
create mode 100644 demos/homepage/_config.yml
create mode 100644 demos/homepage/_includes/footer.html
create mode 100644 demos/homepage/_includes/header.html
create mode 100644 demos/homepage/_layouts/default.html
create mode 100644 demos/homepage/_layouts/page.html
create mode 100644 demos/homepage/assets/style.css
create mode 100644 demos/homepage/bundle.js
create mode 100644 demos/homepage/index.md
create mode 100644 demos/homepage/index.ts
create mode 100644 demos/imagenet/bundle.js
create mode 100644 demos/imagenet/imagenet-demo.html
create mode 100644 demos/imagenet/imagenet-demo.ts
create mode 100644 demos/imagenet/imagenet.html
create mode 100644 demos/imagenet/images/beerbottle.jpg
create mode 100644 demos/imagenet/images/cat.jpg
create mode 100644 demos/imagenet/images/dog1.jpg
create mode 100644 demos/imagenet/images/dog2.jpg
create mode 100644 demos/imagenet/images/piano.jpg
create mode 100644 demos/imagenet/images/saxophone.jpg
create mode 100644 demos/images/benchmark.png
create mode 100644 demos/images/font-embedding.png
create mode 100644 demos/images/imagenet.png
create mode 100644 demos/images/model-builder.png
create mode 100644 demos/images/nn-art.png
create mode 100644 demos/images/paint-image.png
create mode 100644 demos/mnist/fully_connected_feed.py
create mode 100644 demos/mnist/hidden1_biases
create mode 100644 demos/mnist/hidden1_weights
create mode 100644 demos/mnist/hidden2_biases
create mode 100644 demos/mnist/hidden2_weights
create mode 100644 demos/mnist/index.html
create mode 100644 demos/mnist/manifest.json
create mode 100644 demos/mnist/mnist.md
create mode 100644 demos/mnist/mnist.ts
create mode 100644 demos/mnist/sample_data.json
create mode 100644 demos/mnist/softmax_linear_biases
create mode 100644 demos/mnist/softmax_linear_weights
create mode 100644 demos/model-builder/bundle.js
create mode 100644 demos/model-builder/cifar10-conv.json
create mode 100644 demos/model-builder/layer_builder.ts
create mode 100644 demos/model-builder/mnist-conv.json
create mode 100644 demos/model-builder/mnist-fully-connected.json
create mode 100644 demos/model-builder/model-builder-datasets-config.json
create mode 100644 demos/model-builder/model-builder-demo.html
create mode 100644 demos/model-builder/model-builder.html
create mode 100644 demos/model-builder/model-builder.ts
create mode 100644 demos/model-builder/model-layer.html
create mode 100644 demos/model-builder/model-layer.ts
create mode 100644 demos/model-builder/model_builder_util.ts
create mode 100644 demos/model-builder/tensorflow.ts
create mode 100644 demos/models/imagenet_classes.ts
create mode 100644 demos/models/imagenet_util.ts
create mode 100644 demos/models/squeezenet.ts
create mode 100644 demos/ndarray-image-visualizer.html
create mode 100644 demos/ndarray-image-visualizer.ts
create mode 100644 demos/ndarray-logits-visualizer.html
create mode 100644 demos/ndarray-logits-visualizer.ts
create mode 100644 demos/nn-art/bundle.js
create mode 100644 demos/nn-art/cppn.ts
create mode 100644 demos/nn-art/nn-art-demo.html
create mode 100644 demos/nn-art/nn-art.html
create mode 100644 demos/nn-art/nn-art.ts
create mode 100644 demos/nn-art/nn_art_util.ts
create mode 100644 demos/one_plus_one/index.html
create mode 100644 demos/one_plus_one/one_plus_one.ts
create mode 100644 demos/paint-image/bundle.js
create mode 100644 demos/polymer-spec.ts
create mode 100644 demos/xhr-dataset.ts
create mode 100644 docs/roadmap.md
create mode 100644 docs/tutorials/index.md
create mode 100644 docs/tutorials/intro.md
create mode 100644 docs/tutorials/ml_beginners.md
create mode 100644 karma.conf.js
create mode 100644 package.json
create mode 100755 scripts/build-demo
create mode 100755 scripts/build-npm.sh
create mode 100755 scripts/build-standalone.sh
create mode 100644 scripts/convert_uint8_tensor_to_png.py
create mode 100755 scripts/deploy-demo
create mode 100644 scripts/dump_checkpoint_vars.py
create mode 100755 scripts/make-website.sh
create mode 100755 scripts/watch-demo
create mode 100644 src/checkpoint_loader.ts
create mode 100644 src/checkpoint_loader_test.ts
create mode 100644 src/dataset.ts
create mode 100644 src/dataset_test.ts
create mode 100644 src/graph.ts
create mode 100644 src/graph_layers.ts
create mode 100644 src/graph_runner.ts
create mode 100644 src/graph_runner_test.ts
create mode 100644 src/graph_test.ts
create mode 100644 src/graph_util.ts
create mode 100644 src/graph_util_test.ts
create mode 100644 src/index.ts
create mode 100644 src/initializers.ts
create mode 100644 src/input_provider.ts
create mode 100644 src/input_provider_test.ts
create mode 100644 src/math/activation_functions.ts
create mode 100644 src/math/activation_functions_test.ts
create mode 100644 src/math/concat3d_util.ts
create mode 100644 src/math/concat3d_util_test.ts
create mode 100644 src/math/conv_util.ts
create mode 100644 src/math/copy2d_util.ts
create mode 100644 src/math/cost_functions.ts
create mode 100644 src/math/cost_functions_test.ts
create mode 100644 src/math/math.ts
create mode 100644 src/math/math_cpu.ts
create mode 100644 src/math/math_cpu_test.ts
create mode 100644 src/math/math_gpu.ts
create mode 100644 src/math/math_gpu_test.ts
create mode 100644 src/math/ndarray.ts
create mode 100644 src/math/ndarray_test.ts
create mode 100644 src/math/webgl/addscaledmat_gpu.ts
create mode 100644 src/math/webgl/addscaledmat_gpu_test.ts
create mode 100644 src/math/webgl/addsubmuldiv_gpu.ts
create mode 100644 src/math/webgl/addsubmuldiv_gpu_test.ts
create mode 100644 src/math/webgl/argmaxequals_gpu.ts
create mode 100644 src/math/webgl/argmaxequals_gpu_test.ts
create mode 100644 src/math/webgl/argminmax_gpu.ts
create mode 100644 src/math/webgl/argminmax_gpu_test.ts
create mode 100644 src/math/webgl/avg_pool_gpu.ts
create mode 100644 src/math/webgl/avg_pool_gpu_test.ts
create mode 100644 src/math/webgl/batchnorm_gpu.ts
create mode 100644 src/math/webgl/batchnorm_gpu_test.ts
create mode 100644 src/math/webgl/binaryop_gpu.ts
create mode 100644 src/math/webgl/concat3d_gpu.ts
create mode 100644 src/math/webgl/concat3d_gpu_test.ts
create mode 100644 src/math/webgl/conv_backprop_gpu.ts
create mode 100644 src/math/webgl/conv_backprop_gpu_derbias_test.ts
create mode 100644 src/math/webgl/conv_backprop_gpu_derweights_test.ts
create mode 100644 src/math/webgl/conv_backprop_transpose_gpu_test.ts
create mode 100644 src/math/webgl/conv_gpu.ts
create mode 100644 src/math/webgl/conv_gpu_getbiasvalue_test.ts
create mode 100644 src/math/webgl/conv_gpu_getmatrixvalueorzeropad_test.ts
create mode 100644 src/math/webgl/conv_gpu_test.ts
create mode 100644 src/math/webgl/copy_gpu.ts
create mode 100644 src/math/webgl/copy_gpu_test.ts
create mode 100644 src/math/webgl/exp_gpu.ts
create mode 100644 src/math/webgl/exp_gpu_test.ts
create mode 100644 src/math/webgl/gpgpu_context.ts
create mode 100644 src/math/webgl/gpgpu_context_test.ts
create mode 100644 src/math/webgl/gpgpu_util.ts
create mode 100644 src/math/webgl/gpgpu_util_test.ts
create mode 100644 src/math/webgl/log_gpu.ts
create mode 100644 src/math/webgl/log_gpu_test.ts
create mode 100644 src/math/webgl/logsumexp_gpu.ts
create mode 100644 src/math/webgl/logsumexp_gpu_test.ts
create mode 100644 src/math/webgl/max_pool_backprop_gpu.ts
create mode 100644 src/math/webgl/max_pool_backprop_gpu_test.ts
create mode 100644 src/math/webgl/max_pool_gpu.ts
create mode 100644 src/math/webgl/max_pool_gpu_test.ts
create mode 100644 src/math/webgl/max_pool_positions_gpu_test.ts
create mode 100644 src/math/webgl/min_pool_gpu.ts
create mode 100644 src/math/webgl/min_pool_gpu_test.ts
create mode 100644 src/math/webgl/minmax_gpu.ts
create mode 100644 src/math/webgl/minmax_gpu_test.ts
create mode 100644 src/math/webgl/mulbcast_gpu.ts
create mode 100644 src/math/webgl/mulbcast_gpu_test.ts
create mode 100644 src/math/webgl/mulmat_gpu.ts
create mode 100644 src/math/webgl/mulmat_gpu_test.ts
create mode 100644 src/math/webgl/mulmat_packed_gpu.ts
create mode 100644 src/math/webgl/mulmat_packed_gpu_test.ts
create mode 100644 src/math/webgl/neg_gpu.ts
create mode 100644 src/math/webgl/neg_gpu_test.ts
create mode 100644 src/math/webgl/pool_gpu.ts
create mode 100644 src/math/webgl/reducesum_gpu.ts
create mode 100644 src/math/webgl/reducesum_gpu_test.ts
create mode 100644 src/math/webgl/relu_gpu.ts
create mode 100644 src/math/webgl/relu_gpu_test.ts
create mode 100644 src/math/webgl/render_ndarray_gpu_util.ts
create mode 100644 src/math/webgl/render_ndarray_gpu_util_test.ts
create mode 100644 src/math/webgl/reshape_gpu.ts
create mode 100644 src/math/webgl/reshape_gpu_test.ts
create mode 100644 src/math/webgl/resize_bilinear_gpu.ts
create mode 100644 src/math/webgl/resize_bilinear_gpu_test.ts
create mode 100644 src/math/webgl/shader_compiler.ts
create mode 100644 src/math/webgl/sigmoid_gpu.ts
create mode 100644 src/math/webgl/sigmoid_gpu_test.ts
create mode 100644 src/math/webgl/step_gpu.ts
create mode 100644 src/math/webgl/step_gpu_test.ts
create mode 100644 src/math/webgl/tex_util.ts
create mode 100644 src/math/webgl/tex_util_test.ts
create mode 100644 src/math/webgl/texture_manager.ts
create mode 100644 src/math/webgl/trig_gpu.ts
create mode 100644 src/math/webgl/trig_gpu_test.ts
create mode 100644 src/math/webgl/unaryop_gpu.ts
create mode 100644 src/math/webgl/webgl_util.ts
create mode 100644 src/operation_emitter.ts
create mode 100644 src/ops/add.ts
create mode 100644 src/ops/add_test.ts
create mode 100644 src/ops/argmax.ts
create mode 100644 src/ops/argmax_test.ts
create mode 100644 src/ops/argmaxequals.ts
create mode 100644 src/ops/argmaxequals_test.ts
create mode 100644 src/ops/concat3d.ts
create mode 100644 src/ops/concat3d_test.ts
create mode 100644 src/ops/convolution.ts
create mode 100644 src/ops/convolution_test.ts
create mode 100644 src/ops/divide.ts
create mode 100644 src/ops/divide_test.ts
create mode 100644 src/ops/element_wise_activation.ts
create mode 100644 src/ops/element_wise_activation_test.ts
create mode 100644 src/ops/element_wise_cost.ts
create mode 100644 src/ops/element_wise_cost_test.ts
create mode 100644 src/ops/exp.ts
create mode 100644 src/ops/exp_test.ts
create mode 100644 src/ops/linear_combination.ts
create mode 100644 src/ops/linear_combination_test.ts
create mode 100644 src/ops/log.ts
create mode 100644 src/ops/log_test.ts
create mode 100644 src/ops/matmul.ts
create mode 100644 src/ops/matmul_test.ts
create mode 100644 src/ops/max_pool.ts
create mode 100644 src/ops/max_pool_test.ts
create mode 100644 src/ops/multiply.ts
create mode 100644 src/ops/multiply_test.ts
create mode 100644 src/ops/op.ts
create mode 100644 src/ops/reduce_sum.ts
create mode 100644 src/ops/reduce_sum_test.ts
create mode 100644 src/ops/reshape.ts
create mode 100644 src/ops/softmax.ts
create mode 100644 src/ops/softmax_test.ts
create mode 100644 src/ops/split.ts
create mode 100644 src/ops/split_test.ts
create mode 100644 src/ops/subtract.ts
create mode 100644 src/ops/subtract_test.ts
create mode 100644 src/optimizer.ts
create mode 100644 src/priority_queue.ts
create mode 100644 src/priority_queue_test.ts
create mode 100644 src/session.ts
create mode 100644 src/session_test.ts
create mode 100644 src/session_util.ts
create mode 100644 src/session_util_test.ts
create mode 100644 src/sgd_optimizer.ts
create mode 100644 src/tensor_array_map.ts
create mode 100644 src/tensor_array_map_test.ts
create mode 100644 src/test_util.ts
create mode 100644 src/util.ts
create mode 100644 src/util_test.ts
create mode 100644 tsconfig-doc.json
create mode 100644 tsconfig.json
create mode 100644 tslint.json
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000..70399bf242
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+node_modules/
+demos/**/*.js
+demos/**/*.js.map
+coverage/
+bower_components/
diff --git a/.npmignore b/.npmignore
new file mode 100644
index 0000000000..ea77052f14
--- /dev/null
+++ b/.npmignore
@@ -0,0 +1,9 @@
+demos/
+dist/demos/
+dist/**/*.js.map
+docs/
+scripts/
+src/
+coverage/
+bower_components/
+node_modules/
diff --git a/.npmrc b/.npmrc
new file mode 100644
index 0000000000..43c97e719a
--- /dev/null
+++ b/.npmrc
@@ -0,0 +1 @@
+package-lock=false
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000000..6d098153f1
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,15 @@
+// Place your settings in this file to overwrite default and user settings.
+{
+ "search.exclude": {
+ "**/node_modules": true,
+ "**/bower_components": true,
+ "coverage/": true,
+ "dist/": true
+ },
+ "tslint.configFile": "tslint.json",
+ "tslint.enable": true,
+ "tslint.run": "onType",
+ "editor.tabSize": 2,
+ "editor.insertSpaces": true,
+ "files.insertFinalNewline": true
+}
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
new file mode 100644
index 0000000000..dd81624820
--- /dev/null
+++ b/.vscode/tasks.json
@@ -0,0 +1,16 @@
+{
+ "version": "2.0.0",
+ "tasks": [
+ {
+ "command": "npm",
+ "taskName": "lint",
+ "type": "shell",
+ "suppressTaskName": true,
+ "args": [ "run", "lint"],
+ "problemMatcher": {
+ "base": "$tslint5",
+ "fileLocation": "absolute"
+ }
+ }
+ ]
+}
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000000..a9851beff2
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,26 @@
+# How to Contribute
+
+We'd love to accept your patches and contributions to this project. There are
+just a few small guidelines you need to follow.
+
+## Contributor License Agreement
+
+Contributions to this project must be accompanied by a Contributor License
+Agreement. You (or your employer) retain the copyright to your contribution,
+this simply gives us permission to use and redistribute your contributions as
+part of the project. Head over to to see
+your current agreements on file or to sign a new one.
+
+You generally only need to submit a CLA once, so if you've already submitted one
+(even if it was for a different project), you probably don't need to do it
+again.
+
+## Code reviews
+
+All submissions, including submissions by project members, require review. We
+use GitHub pull requests for this purpose. Consult
+[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
+information on using pull requests.
+
+We require unit tests for most code, instructions for running our unit test
+suites are in the documentation.
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000000..d645695673
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000000..7eb2ce669a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,100 @@
+---
+layout: page
+order: 1
+---
+
+# Getting started
+
+**deeplearn.js** is an open source hardware-accelerated JavaScript library for
+machine intelligence. **deeplearn.js** brings performant machine learning
+building blocks to the web, allowing you to train neural networks in a browser
+or run pre-trained models in inference mode.
+
+**deeplearn.js** has two APIs, an immediate execution model (think NumPy) and a
+deferred execution model mirroring the TensorFlow API.
+**deeplearn.js**
+was originally developed by the Google Brain PAIR team to build powerful
+interactive machine learning tools for the browser, but it can be used for
+everything from education, to model understanding, to art projects.
+
+## Usage
+
+#### From JavaScript
+
+Typescript is the preferred language of choice for **deeplearn.js**, however
+you can use it with plain JavaScript.
+
+For this use case, you can load the library directly from Google CDN:
+
+```html
+
+```
+
+#### From TypeScript
+
+To build **deeplearn.js** from source, we need to clone the project and prepare
+the dev environment:
+
+```bash
+$ git clone https://pair-code.github.com/learnjs
+$ cd learnjs
+$ npm run prep # Installs node modules and bower components.
+```
+
+To build a standalone library that can be used directly in the browser using a
+`
+
+
+
+
+
+
+
diff --git a/demos/benchmarks/benchmark-demo.html b/demos/benchmarks/benchmark-demo.html
new file mode 100644
index 0000000000..ba981fb1ee
--- /dev/null
+++ b/demos/benchmarks/benchmark-demo.html
@@ -0,0 +1,49 @@
+
+
+
+