@tensorflow/tfjs-converter
Advanced tools
Comparing version 1.0.0-alpha7 to 1.0.0
@@ -17,4 +17,3 @@ /** | ||
*/ | ||
import * as tfc from '@tensorflow/tfjs-core'; | ||
import { io } from '@tensorflow/tfjs-core'; | ||
import { InferenceModel, io, ModelPredictConfig, NamedTensorMap, Tensor } from '@tensorflow/tfjs-core'; | ||
import { NamedTensorsMap, TensorInfo } from '../data/types'; | ||
@@ -26,4 +25,9 @@ export declare const TFHUB_SEARCH_PARAM = "?tfjs-format=file"; | ||
* SavedModel GraphDef and allows inference exeuction. | ||
* | ||
* A `tf.GraphModel` can only be created by loading from a model converted from | ||
* a [TensorFlow SavedModel](https://www.tensorflow.org/guide/saved_model) using | ||
* the command line converter tool and loaded via `tf.loadGraphModel`. | ||
*/ | ||
export declare class GraphModel implements tfc.InferenceModel { | ||
/** @doc {heading: 'Models', subheading: 'Classes'} */ | ||
export declare class GraphModel implements InferenceModel { | ||
private modelUrl; | ||
@@ -92,3 +96,4 @@ private loadOptions; | ||
*/ | ||
predict(inputs: tfc.Tensor | tfc.Tensor[] | tfc.NamedTensorMap, config?: tfc.ModelPredictConfig): tfc.Tensor | tfc.Tensor[] | tfc.NamedTensorMap; | ||
/** @doc {heading: 'Models', subheading: 'Classes'} */ | ||
predict(inputs: Tensor | Tensor[] | NamedTensorMap, config?: ModelPredictConfig): Tensor | Tensor[] | NamedTensorMap; | ||
private constructTensorMap; | ||
@@ -109,3 +114,4 @@ /** | ||
*/ | ||
execute(inputs: tfc.Tensor | tfc.Tensor[] | tfc.NamedTensorMap, outputs?: string | string[]): tfc.Tensor | tfc.Tensor[]; | ||
/** @doc {heading: 'Models', subheading: 'Classes'} */ | ||
execute(inputs: Tensor | Tensor[] | NamedTensorMap, outputs?: string | string[]): Tensor | Tensor[]; | ||
private execute_; | ||
@@ -126,3 +132,4 @@ /** | ||
*/ | ||
executeAsync(inputs: tfc.Tensor | tfc.Tensor[] | tfc.NamedTensorMap, outputs?: string | string[]): Promise<tfc.Tensor | tfc.Tensor[]>; | ||
/** @doc {heading: 'Models', subheading: 'Classes'} */ | ||
executeAsync(inputs: Tensor | Tensor[] | NamedTensorMap, outputs?: string | string[]): Promise<Tensor | Tensor[]>; | ||
private convertTensorMapToTensorsMap; | ||
@@ -132,2 +139,3 @@ /** | ||
*/ | ||
/** @doc {heading: 'Models', subheading: 'Classes'} */ | ||
dispose(): void; | ||
@@ -134,0 +142,0 @@ } |
@@ -54,3 +54,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tfc = require("@tensorflow/tfjs-core"); | ||
var tfjs_core_1 = require("@tensorflow/tfjs-core"); | ||
var operation_mapper_1 = require("../operations/operation_mapper"); | ||
@@ -63,3 +63,8 @@ var graph_executor_1 = require("./graph_executor"); | ||
* SavedModel GraphDef and allows inference exeuction. | ||
* | ||
* A `tf.GraphModel` can only be created by loading from a model converted from | ||
* a [TensorFlow SavedModel](https://www.tensorflow.org/guide/saved_model) using | ||
* the command line converter tool and loaded via `tf.loadGraphModel`. | ||
*/ | ||
/** @doc {heading: 'Models', subheading: 'Classes'} */ | ||
var GraphModel = /** @class */ (function () { | ||
@@ -134,11 +139,10 @@ /** | ||
else if (this.loadOptions.requestInit != null) { | ||
this.handler = | ||
tfc.io.browserHTTPRequest(path, this.loadOptions); | ||
this.handler = tfjs_core_1.io.browserHTTPRequest(path, this.loadOptions); | ||
} | ||
else { | ||
var handlers = tfc.io.getLoadHandlers(path, this.loadOptions.onProgress); | ||
var handlers = tfjs_core_1.io.getLoadHandlers(path, this.loadOptions.onProgress); | ||
if (handlers.length === 0) { | ||
// For backward compatibility: if no load handler can be found, | ||
// assume it is a relative http path. | ||
handlers.push(tfc.io.browserHTTPRequest(path, this.loadOptions)); | ||
handlers.push(tfjs_core_1.io.browserHTTPRequest(path, this.loadOptions)); | ||
} | ||
@@ -172,3 +176,3 @@ else if (handlers.length > 1) { | ||
this.version = graph.versions.producer + "." + graph.versions.minConsumer; | ||
weightMap = tfc.io.decodeWeights(artifacts.weightData, artifacts.weightSpecs); | ||
weightMap = tfjs_core_1.io.decodeWeights(artifacts.weightData, artifacts.weightSpecs); | ||
this.executor = | ||
@@ -218,2 +222,3 @@ new graph_executor_1.GraphExecutor(operation_mapper_1.OperationMapper.Instance.transformGraph(graph)); | ||
*/ | ||
/** @doc {heading: 'Models', subheading: 'Classes'} */ | ||
GraphModel.prototype.predict = function (inputs, config) { | ||
@@ -223,3 +228,3 @@ return this.execute_(inputs, true, this.outputNodes); | ||
GraphModel.prototype.constructTensorMap = function (inputs) { | ||
var inputArray = inputs instanceof tfc.Tensor ? [inputs] : inputs; | ||
var inputArray = inputs instanceof tfjs_core_1.Tensor ? [inputs] : inputs; | ||
if (inputArray.length !== this.inputNodes.length) { | ||
@@ -249,2 +254,3 @@ throw new Error('Input tensor count mismatch,' + | ||
*/ | ||
/** @doc {heading: 'Models', subheading: 'Classes'} */ | ||
GraphModel.prototype.execute = function (inputs, outputs) { | ||
@@ -256,3 +262,3 @@ return this.execute_(inputs, false, outputs); | ||
outputs = outputs || this.outputNodes; | ||
if (inputs instanceof tfc.Tensor || Array.isArray(inputs)) { | ||
if (inputs instanceof tfjs_core_1.Tensor || Array.isArray(inputs)) { | ||
inputs = this.constructTensorMap(inputs); | ||
@@ -284,2 +290,3 @@ } | ||
*/ | ||
/** @doc {heading: 'Models', subheading: 'Classes'} */ | ||
GraphModel.prototype.executeAsync = function (inputs, outputs) { | ||
@@ -297,3 +304,3 @@ return __awaiter(this, void 0, void 0, function () { | ||
outputs = outputs || this.outputNodes; | ||
if (inputs instanceof tfc.Tensor || Array.isArray(inputs)) { | ||
if (inputs instanceof tfjs_core_1.Tensor || Array.isArray(inputs)) { | ||
inputs = this.constructTensorMap(inputs); | ||
@@ -321,2 +328,3 @@ } | ||
*/ | ||
/** @doc {heading: 'Models', subheading: 'Classes'} */ | ||
GraphModel.prototype.dispose = function () { | ||
@@ -323,0 +331,0 @@ this.executor.dispose(); |
/** @license See the LICENSE file. */ | ||
declare const version = "1.0.0-alpha7"; | ||
declare const version = "1.0.0"; | ||
export { version }; |
@@ -5,4 +5,4 @@ "use strict"; | ||
// This code is auto-generated, do not modify this file! | ||
var version = '1.0.0-alpha7'; | ||
var version = '1.0.0'; | ||
exports.version = version; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@tensorflow/tfjs-converter", | ||
"version": "1.0.0-alpha7", | ||
"version": "1.0.0", | ||
"description": "Tensorflow model converter for javascript", | ||
@@ -17,6 +17,6 @@ "main": "dist/src/index.js", | ||
"peerDependencies": { | ||
"@tensorflow/tfjs-core": "1.0.0-alpha5" | ||
"@tensorflow/tfjs-core": "1.0.0" | ||
}, | ||
"devDependencies": { | ||
"@tensorflow/tfjs-core": "1.0.0-alpha5", | ||
"@tensorflow/tfjs-core": "1.0.0", | ||
"@types/jasmine": "~2.8.6", | ||
@@ -23,0 +23,0 @@ "@types/long": "~3.0.32", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2024429
14987
2