Skip to content

Commit

Permalink
Update tf.js
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed Sep 11, 2022
1 parent 47a4d61 commit 966da64
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions source/tf.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,12 @@ tf.ModelFactory = class {
}
}
const openShards = (shards) => {
const dtype_size_map = new Map([ [ 'float16', 2 ], [ 'float32', 4 ], [ 'float64', 8 ], [ 'int8', 1 ], [ 'int16', 2 ], [ 'int32', 4 ], [ 'int64', 8 ], [ 'uint8', 1 ], [ 'uint16', 2 ], [ 'uint32', 4 ], [ 'uint64', 8 ], [ 'bool', 1 ] ]);
const dtype_size_map = new Map([
[ 'float16', 2 ], [ 'float32', 4 ], [ 'float64', 8 ],
[ 'int8', 1 ], [ 'int16', 2 ], [ 'int32', 4 ], [ 'int64', 8 ],
[ 'uint8', 1 ], [ 'uint16', 2 ], [ 'uint32', 4 ], [ 'uint64', 8 ],
[ 'bool', 1 ]
]);
for (const manifest of manifests) {
let buffer = null;
if (Array.isArray(manifest.paths) && manifest.paths.length > 0 && manifest.paths.every((path) => shards.has(path))) {
Expand Down Expand Up @@ -2432,7 +2437,7 @@ tf.JsonReader = class {
const message = new tf.proto.tensorflow.TensorShapeProto();
message.dim = (json.dim || []).map((json) => {
const message = new tf.proto.tensorflow.TensorShapeProto.Dim();
message.size = json.size;
message.size = typeof json.size === 'string' ? parseInt(json.size, 10) : json.size;
message.name = json.name;
return message;
});
Expand Down

0 comments on commit 966da64

Please sign in to comment.