@tensorflow/tfjs-converter
Advanced tools
Comparing version 2.8.1 to 2.8.2
@@ -40,2 +40,3 @@ /** | ||
private resourceManager; | ||
private signature; | ||
readonly modelVersion: string; | ||
@@ -48,2 +49,3 @@ readonly inputNodes: string[]; | ||
readonly metadata: {}; | ||
readonly modelSignature: {}; | ||
/** | ||
@@ -72,3 +74,2 @@ * @param modelUrl url for the model, or an `io.IOHandler`. | ||
loadSync(artifacts: io.ModelArtifacts): boolean; | ||
private isOldVersion; | ||
/** | ||
@@ -75,0 +76,0 @@ * Save the configuration and/or weights of the GraphModel. |
@@ -74,2 +74,5 @@ /** | ||
} | ||
get modelSignature() { | ||
return this.signature; | ||
} | ||
findIOHandler() { | ||
@@ -120,9 +123,7 @@ const path = this.modelUrl; | ||
const graph = this.artifacts.modelTopology; | ||
const oldVersion = this.isOldVersion(artifacts.convertedBy); | ||
let signature; | ||
if (oldVersion) { | ||
if (this.artifacts.userDefinedMetadata != null) { | ||
signature = // tslint:disable-next-line:no-any | ||
this.artifacts.userDefinedMetadata.signature; | ||
} | ||
if (this.artifacts.userDefinedMetadata != null && | ||
this.artifacts.userDefinedMetadata.signature != null) { | ||
signature = // tslint:disable-next-line:no-any | ||
this.artifacts.userDefinedMetadata.signature; | ||
} | ||
@@ -132,5 +133,6 @@ else { | ||
} | ||
this.signature = signature; | ||
this.version = `${graph.versions.producer}.${graph.versions.minConsumer}`; | ||
const weightMap = io.decodeWeights(this.artifacts.weightData, this.artifacts.weightSpecs); | ||
this.executor = new GraphExecutor(OperationMapper.Instance.transformGraph(graph, signature)); | ||
this.executor = new GraphExecutor(OperationMapper.Instance.transformGraph(graph, this.signature)); | ||
this.executor.weightMap = this.convertTensorMapToTensorsMap(weightMap); | ||
@@ -153,19 +155,2 @@ // Attach a model-level resourceManager to each executor to share resources, | ||
} | ||
isOldVersion(version) { | ||
if (version) { | ||
let semVer = version.split('TensorFlow.js Converter v'); | ||
semVer = semVer[0].split('.'); | ||
const majorVer = parseInt(semVer[0], 10); | ||
const minorVer = parseInt(semVer[1], 10); | ||
// 1.x and 2.x <= 2.7 are old versions. | ||
if (majorVer <= 1) { | ||
return true; | ||
} | ||
if (majorVer === 2 && minorVer <= 7) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
return true; | ||
} | ||
/** | ||
@@ -172,0 +157,0 @@ * Save the configuration and/or weights of the GraphModel. |
/** @license See the LICENSE file. */ | ||
declare const version = "2.8.1"; | ||
declare const version = "2.8.2"; | ||
export { version }; |
/** @license See the LICENSE file. */ | ||
// This code is auto-generated, do not modify this file! | ||
const version = '2.8.1'; | ||
const version = '2.8.2'; | ||
export { version }; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@tensorflow/tfjs-converter", | ||
"version": "2.8.1", | ||
"version": "2.8.2", | ||
"description": "Tensorflow model converter for javascript", | ||
@@ -18,3 +18,3 @@ "main": "dist/tf-converter.node.js", | ||
"peerDependencies": { | ||
"@tensorflow/tfjs-core": "2.8.1" | ||
"@tensorflow/tfjs-core": "2.8.2" | ||
}, | ||
@@ -26,4 +26,4 @@ "devDependencies": { | ||
"@rollup/plugin-typescript": "^3.0.0", | ||
"@tensorflow/tfjs-backend-cpu": "2.8.1", | ||
"@tensorflow/tfjs-core": "2.8.1", | ||
"@tensorflow/tfjs-backend-cpu": "2.8.2", | ||
"@tensorflow/tfjs-core": "2.8.2", | ||
"@types/argparse": "^1.0.38", | ||
@@ -30,0 +30,0 @@ "@types/deep-equal": "^1.0.1", |
@@ -46,2 +46,3 @@ /** | ||
private resourceManager: ResourceManager; | ||
private signature: tensorflow.ISignatureDef; | ||
@@ -77,2 +78,6 @@ // Returns the version information for the tensorflow model GraphDef. | ||
get modelSignature(): {} { | ||
return this.signature; | ||
} | ||
/** | ||
@@ -144,13 +149,12 @@ * @param modelUrl url for the model, or an `io.IOHandler`. | ||
const oldVersion = this.isOldVersion(artifacts.convertedBy); | ||
let signature; | ||
if (oldVersion) { | ||
if (this.artifacts.userDefinedMetadata != null) { | ||
signature = // tslint:disable-next-line:no-any | ||
(this.artifacts.userDefinedMetadata as any).signature as | ||
tensorflow.ISignatureDef; | ||
} | ||
if (this.artifacts.userDefinedMetadata != null && | ||
this.artifacts.userDefinedMetadata.signature != null) { | ||
signature = // tslint:disable-next-line:no-any | ||
(this.artifacts.userDefinedMetadata as any).signature as | ||
tensorflow.ISignatureDef; | ||
} else { | ||
signature = this.artifacts.signature; | ||
} | ||
this.signature = signature; | ||
@@ -161,3 +165,3 @@ this.version = `${graph.versions.producer}.${graph.versions.minConsumer}`; | ||
this.executor = new GraphExecutor( | ||
OperationMapper.Instance.transformGraph(graph, signature)); | ||
OperationMapper.Instance.transformGraph(graph, this.signature)); | ||
this.executor.weightMap = this.convertTensorMapToTensorsMap(weightMap); | ||
@@ -184,24 +188,2 @@ // Attach a model-level resourceManager to each executor to share resources, | ||
private isOldVersion(version: string) { | ||
if (version) { | ||
let semVer = version.split('TensorFlow.js Converter v'); | ||
semVer = semVer[0].split('.'); | ||
const majorVer = parseInt(semVer[0], 10); | ||
const minorVer = parseInt(semVer[1], 10); | ||
// 1.x and 2.x <= 2.7 are old versions. | ||
if (majorVer <= 1) { | ||
return true; | ||
} | ||
if (majorVer === 2 && minorVer <= 7) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
return true; | ||
} | ||
/** | ||
@@ -208,0 +190,0 @@ * Save the configuration and/or weights of the GraphModel. |
/** @license See the LICENSE file. */ | ||
// This code is auto-generated, do not modify this file! | ||
const version = '2.8.1'; | ||
const version = '2.8.2'; | ||
export {version}; |
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
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 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 not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
12727788
0
46528