Skip to content

Commit

Permalink
Modularize: Remove pieces that are going in different repos (tensorfl…
Browse files Browse the repository at this point in the history
…ow#876)

This change is part of the modularization and moving things to different repos.

Remove deprecated/private API from `src/index.ts`

Also remove:
- `website/` (moving to another repo)
- `docs/` (moving to another repo)
- `starter/` (moving to another repo)
- `src/data/` (deprecated)
- `demos/`
  - `adder/`
  - `imagenet/`
  - `lstm/`
  - `mnist/`
  - `mnist_eager/`
  - `one_plus_one/`
  - `rune_recognition/`
  • Loading branch information
dsmilkov authored Mar 28, 2018
1 parent 4d54e63 commit 6d77e43
Show file tree
Hide file tree
Showing 121 changed files with 405 additions and 12,174 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ scripts/**/*.js
coverage/
package-lock.json
npm-debug.log
yarn-error.log
.DS_Store
dist/
.idea/
Expand Down
6 changes: 0 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
language: node_js
node_js: "8"
addons:
apt:
packages:
- "python3"
- "python3-pip"
script:
- ./scripts/run_python_tests.sh
- ./scripts/build_and_lint_all
- if [ "$BROWSERSTACK_KEY" ]; then yarn test-travis; fi
18 changes: 4 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ the dev environment:
```bash
$ git clone https://github.com/PAIR-code/deeplearnjs.git
$ cd deeplearnjs
$ yarn prep # Installs dependencies.
$ yarn # Installs dependencies.
```

#### Yarn vs NPM
Expand Down Expand Up @@ -135,21 +135,11 @@ $ yarn test --single-run
```

#### Packaging (browser and npm)
To build a standalone ES5 library that can be imported in the browser with a
`<script>` tag:

```bash
$ ./scripts/build-standalone.sh # Builds standalone library.
>> Stored standalone library at dist/deeplearn(.min).js
```

To build an npm package:

```bash
$ ./scripts/build-npm.sh
...
Stored standalone library at dist/deeplearn(.min).js
deeplearn-VERSION.tgz
$ yarn build-npm
> Stored standalone library at dist/deeplearn(.min).js
> deeplearn-VERSION.tgz
```

To install it locally, run `npm install ./deeplearn-VERSION.tgz`.
Expand Down
34 changes: 0 additions & 34 deletions demos/adder/adder.ts

This file was deleted.

34 changes: 0 additions & 34 deletions demos/adder/index.html

This file was deleted.

24 changes: 11 additions & 13 deletions demos/benchmarks/pool_benchmarks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,24 @@ export interface PoolBenchmarkParams {
stride: number;
}

function getPoolingOp(option: string):
(x: dl.Tensor3D, filterSize: [number, number]|number,
strides: [number, number]|number, pad: 'valid'|'same'|number) =>
dl.Tensor3D {
function getPoolingOp(option: string): (
x: dl.Tensor3D, filterSize: [number, number]|number,
strides: [number, number]|number) => dl.Tensor3D {
switch (option) {
case 'max':
return (x: dl.Tensor3D, filterSize: [number, number]|number,
strides: [number, number]|number, pad: 'valid'|'same'|number) => {
return x.maxPool(filterSize, strides, pad);
strides: [number, number]|number) => {
return x.maxPool(filterSize, strides, 'same');
};
case 'min':
return (x: dl.Tensor3D, filterSize: [number, number]|number,
strides: [number, number]|number, pad: 'valid'|'same'|number) => {
return x.minPool(filterSize, strides, pad);
strides: [number, number]|number) => {
return x.minPool(filterSize, strides, 'same');
};
case 'avg':
return (x: dl.Tensor3D, filterSize: [number, number]|number,
strides: [number, number]|number, pad: 'valid'|'same'|number) => {
return x.avgPool(filterSize, strides, pad);
strides: [number, number]|number) => {
return x.avgPool(filterSize, strides, 'same');
};
default:
throw new Error(`Not found such ops: ${option}`);
Expand All @@ -62,14 +61,13 @@ export class PoolCPUBenchmark implements BenchmarkTest {
const xShape: [number, number, number] = [size, size, outputDepth];
const fieldSize = params.fieldSize;
const stride = params.stride;
const zeroPad = dl.conv_util.computeDefaultPad(xShape, fieldSize, stride);
const op = getPoolingOp(option);

const x: dl.Tensor3D = dl.randomUniform(xShape, -1, 1);

const start = performance.now();
for (let i = 0; i < CPU_OP_RUNS; i++) {
op(x, fieldSize, stride, zeroPad);
op(x, fieldSize, stride);
}
const avgTime = (performance.now() - start) / CPU_OP_RUNS;
return new Promise<number>((resolve, reject) => {
Expand All @@ -90,7 +88,7 @@ export class PoolGPUBenchmark implements BenchmarkTest {
const x: dl.Tensor3D = dl.randomUniform(xShape, -1, 1);
const op = getPoolingOp(option);

const benchmark = () => op(x, fieldSize, stride, 'same');
const benchmark = () => op(x, fieldSize, stride);
const time = await benchmark_util.warmupAndBenchmarkGPU(benchmark);

x.dispose();
Expand Down
1 change: 0 additions & 1 deletion demos/fast-style-transfer/fast-style-transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/

import * as dl from 'deeplearn';

import {PolymerElement, PolymerHTMLElement} from '../polymer-spec';

import {TransformNet} from './net';
Expand Down
3 changes: 2 additions & 1 deletion demos/fast-style-transfer/net.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* =============================================================================
*/
import * as dl from 'deeplearn';
import {CheckpointLoader} from 'deeplearn-legacy-loader';

const GOOGLE_CLOUD_STORAGE_DIR =
'https://storage.googleapis.com/learnjs-data/checkpoint_zoo/transformnet/';
Expand Down Expand Up @@ -45,7 +46,7 @@ export class TransformNet {
async load(): Promise<void> {
if (this.variableDictionary[this.style] == null) {
const checkpointLoader =
new dl.CheckpointLoader(GOOGLE_CLOUD_STORAGE_DIR + this.style + '/');
new CheckpointLoader(GOOGLE_CLOUD_STORAGE_DIR + this.style + '/');
this.variableDictionary[this.style] =
await checkpointLoader.getAllVariables();
}
Expand Down
118 changes: 0 additions & 118 deletions demos/imagenet/imagenet.html

This file was deleted.

Loading

0 comments on commit 6d77e43

Please sign in to comment.