This commit is contained in:
Michal Moskal 2020-10-15 12:47:07 +02:00
Родитель 81cddcbb9b
Коммит c6c96180f3
8 изменённых файлов: 439 добавлений и 316 удалений

2
Makefile Normal file
Просмотреть файл

@ -0,0 +1,2 @@
all:
yarn prepare

Просмотреть файл

@ -1,13 +1,13 @@
import * as tf from '@tensorflow/tfjs' import * as tf from '@tensorflow/tfjs'
import * as fs from 'fs' import * as fs from 'fs'
import * as U from '../src/util'
import * as path from 'path' import * as path from 'path'
import * as child_process from 'child_process' import * as child_process from 'child_process'
import { option, program as commander } from "commander" import { program as commander } from "commander"
import { compileModel, compileModelAndFullValidate } from '../src/driver' import {
import { Options } from '../src/compiler' compileModel, compileModelAndFullValidate,
import { sampleModel, testAllModels } from '../src/main' Options, sampleModel, testAllModels,
import { testFloatConv } from '../src/float16' testFloatConv
} from '../..'
interface CmdOptions { interface CmdOptions {
debug?: boolean debug?: boolean
@ -211,3 +211,5 @@ export async function mainCli() {
console.error(e.stack) console.error(e.stack)
} }
} }
if (require.main === module) mainCli()

25
cli/tsconfig.json Normal file
Просмотреть файл

@ -0,0 +1,25 @@
{
"compilerOptions": {
"moduleResolution": "node",
"target": "es2017",
"module": "commonjs",
"lib": ["es2015", "es2016", "es2017"],
"strict": false,
"sourceMap": true,
"declaration": true,
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"preserveConstEnums": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"noImplicitAny": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"outDir": "../built/cli",
"newLine": "LF",
"typeRoots": [
"../node_modules/@types"
]
}
}

Просмотреть файл

@ -3,23 +3,32 @@
"version": "1.1.1", "version": "1.1.1",
"description": "", "description": "",
"scripts": { "scripts": {
"build": "node node_modules/typescript/bin/tsc", "prepare": "node node_modules/rollup/dist/bin/rollup -c rollup.config.ts && node node_modules/typescript/bin/tsc --project cli",
"test": "node ml4f -T", "test": "node ml4f -T",
"watch-cli": "node node_modules/typescript/bin/tsc --watch", "watch-cli": "node node_modules/typescript/bin/tsc --watch --project cli",
"watch": "node node_modules/rollup/dist/bin/rollup -c rollup.config.ts -w" "watch": "node node_modules/rollup/dist/bin/rollup -c rollup.config.ts -w"
}, },
"author": "", "author": "",
"license": "MIT", "license": "MIT",
"bin": "./ml4f",
"types": "./built/ml4f.d.ts",
"main": "./built/ml4f",
"files": [
"./built"
],
"devDependencies": {
"rollup": "^2.26.4",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-dts": "^1.4.13",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-sourcemaps": "^0.6.2",
"rollup-plugin-typescript2": "^0.27.2",
"typescript": "^4.0.3"
},
"dependencies": { "dependencies": {
"@tensorflow/tfjs": "^2.3.0", "@tensorflow/tfjs": "^2.3.0",
"@tensorflow/tfjs-node": "^2.3.0", "@tensorflow/tfjs-node": "^2.3.0",
"@tensorflow/tfjs-vis": "^1.4.3", "@tensorflow/tfjs-vis": "^1.4.3",
"commander": "^6.1.0", "commander": "^6.1.0"
"rollup": "^2.26.4",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-sourcemaps": "^0.6.2",
"rollup-plugin-typescript2": "^0.27.2",
"typescript": "^3.9.7"
} }
} }

Просмотреть файл

@ -1,6 +1,7 @@
import commonjs from 'rollup-plugin-commonjs'; import commonjs from 'rollup-plugin-commonjs';
import typescript from 'rollup-plugin-typescript2'; import typescript from 'rollup-plugin-typescript2';
import json from 'rollup-plugin-json' import json from 'rollup-plugin-json'
import dts from "rollup-plugin-dts";
export default [ export default [
{ src: 'src/main.ts', dst: 'built/ml4f.js' } { src: 'src/main.ts', dst: 'built/ml4f.js' }
@ -14,7 +15,6 @@ export default [
tsconfigOverride: { tsconfigOverride: {
compilerOptions: { compilerOptions: {
module: 'ES2015', module: 'ES2015',
declaration: false
} }
} }
}), }),
@ -39,4 +39,8 @@ export default [
console.warn(warning.code, warning.message) console.warn(warning.code, warning.message)
} }
})) })).concat([{
input: "./built/main.d.ts",
output: [{ file: "built/ml4f.d.ts", format: "es" }],
plugins: [dts()],
}])

Просмотреть файл

@ -4,3 +4,4 @@ export * from "./library"
export * from "./driver" export * from "./driver"
export * from "./util" export * from "./util"
export * from "./testing" export * from "./testing"
export * from "./float16"

Просмотреть файл

@ -5,7 +5,6 @@
"module": "commonjs", "module": "commonjs",
"lib": ["es2015", "es2016", "es2017"], "lib": ["es2015", "es2016", "es2017"],
"strict": false, "strict": false,
"jsx": "react",
"sourceMap": true, "sourceMap": true,
"declaration": true, "declaration": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
@ -23,7 +22,5 @@
"node_modules/@types" "node_modules/@types"
] ]
}, },
"include": [ "include": [ "src" ]
"src", "cli"
]
} }

673
yarn.lock

Разница между файлами не показана из-за своего большого размера Загрузить разницу