Skip to content

Commit a34c9b0

Browse files
committed
Update base.js (#1558)
1 parent 6ec6c37 commit a34c9b0

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

source/python.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ python.Execution = class {
3636
this.set(key, value);
3737
}
3838
__getitem__(key) {
39-
return this.get(key);
39+
if (!super.has(key)) {
40+
throw new python.Error(`KeyError: ${key}`);
41+
}
42+
return super.get(key);
4043
}
4144
__delitem__(key) {
4245
this.delete(key);
@@ -19811,13 +19814,13 @@ python.Execution = class {
1981119814
}
1981219815
deserialize_graph_output(output) {
1981319816
if (output.type === 'as_tensor') {
19814-
return this.serialized_name_to_node.get(output.as_tensor.name);
19817+
return this.serialized_name_to_node.__getitem__(output.as_tensor.name);
1981519818
} else if (output.type === 'as_sym_int') {
19816-
return this.serialized_name_to_node.get(output.as_sym_int.as_name);
19819+
return this.serialized_name_to_node.__getitem__(output.as_sym_int.as_name);
1981719820
} else if (output.type === 'as_sym_bool') {
19818-
return this.serialized_name_to_node.get(output.as_sym_bool.as_name);
19821+
return this.serialized_name_to_node.__getitem__(output.as_sym_bool.as_name);
1981919822
} else if (output.type === 'as_sym_float') {
19820-
return this.serialized_name_to_node.get(output.as_sym_float.as_name);
19823+
return this.serialized_name_to_node.__getitem__(output.as_sym_float.as_name);
1982119824
} else if (output.type === 'as_int') {
1982219825
return output.as_int;
1982319826
} else if (output.type === 'as_float') {
@@ -20201,7 +20204,13 @@ python.Execution = class {
2020120204
return result;
2020220205
} else if (typ_ === 'as_ints' || typ_ === 'as_floats' || typ_ === 'as_bools' || typ_ === 'as_strings') {
2020320206
return Array.from(value);
20204-
} else if (typ_ === 'as_sym_ints' || typ_ === 'as_sym_bools') {
20207+
} else if (typ_ === 'as_int_lists') {
20208+
return value.map((dims) => Array.from(dims));
20209+
} else if (typ_ === 'as_float_lists') {
20210+
return value.map((floats) => Array.from(floats));
20211+
} else if (typ_ === 'as_nested_tensors') {
20212+
return value.map((inner_list) => inner_list.map((arg) => this.serialized_name_to_node.get(arg.name)));
20213+
} else if (typ_ === 'as_sym_ints' || typ_ === 'as_sym_bools' || typ_ === 'as_sym_floats') {
2020520214
return value.map((arg) => this.deserialize_sym_argument(arg));
2020620215
} else if (typ_ === 'as_optional_tensors') {
2020720216
const deserialize_optional_tensor_args = (a) => {

source/view.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4309,6 +4309,7 @@ view.TensorView = class extends view.Expander {
43094309
case 'float8e5m2': data_type = 'float16'; break;
43104310
case 'float8e5m2fnuz': data_type = 'float16'; break;
43114311
case 'float8e8m0fnu': data_type = 'float16'; break;
4312+
case 'float8e8m0': data_type = 'float16'; break;
43124313
case 'int4': data_type = 'int8'; break;
43134314
case 'int48': data_type = 'int64'; break;
43144315
default: data_type = tensor.type.dataType; break;

0 commit comments

Comments
 (0)