From bf43f6e8a10a6c095f5591db0885a6be20d6d4bc Mon Sep 17 00:00:00 2001 From: Lutz Roeder Date: Tue, 15 Oct 2024 18:25:46 -0700 Subject: [PATCH] Update python.js (#637) --- source/python.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/python.js b/source/python.js index b006145e1d..9876d51d02 100644 --- a/source/python.js +++ b/source/python.js @@ -6163,7 +6163,7 @@ python.Execution = class { }); this.registerType('torch.ClassType', class extends torch.Type { constructor(qualified_name, cu, is_module) { - super(); + super('ClassType'); this._qualified_name = qualified_name; this._is_module = is_module; this._attributes = new Map(); @@ -6247,6 +6247,9 @@ python.Execution = class { elements() { return this._elements; } + __str__() { + return `Tuple[${this.elements().map((elem) => elem.toString()).join(', ')}]`; + } }); this.registerType('torch.TensorType', class extends torch.Type { constructor() { @@ -6328,6 +6331,9 @@ python.Execution = class { getValueType() { return this._value; } + __str__() { + return `Dict(${this.getKeyType().toString()}, ${this.getValueType().toString()})`; + } }); this.registerType('torch.DeviceObjType', class extends torch.Type { constructor() {