File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -1263,6 +1263,18 @@ class Usage(NamedTuple):
1263
1263
idx : int
1264
1264
1265
1265
1266
+ def _short_tensor_str_for_node (x : Value ) -> str :
1267
+ if x .const_value is None :
1268
+ return ""
1269
+ if x .const_value .size <= 10 :
1270
+ try :
1271
+ data = x .const_value .numpy ().tolist ()
1272
+ except Exception : # pylint: disable=broad-except
1273
+ return "{...}"
1274
+ return f"{{{ data } }}"
1275
+ return "{...}"
1276
+
1277
+
1266
1278
class Node (_protocols .NodeProtocol , _display .PrettyPrintable ):
1267
1279
"""IR Node.
1268
1280
@@ -1427,7 +1439,7 @@ def __str__(self) -> str:
1427
1439
+ ", " .join (
1428
1440
[
1429
1441
(
1430
- f"%{ _quoted (x .name ) if x .name else 'anonymous:' + str (id (x ))} { x . _constant_tensor_part ( )} "
1442
+ f"%{ _quoted (x .name ) if x .name else 'anonymous:' + str (id (x ))} { _short_tensor_str_for_node ( x )} "
1431
1443
if x is not None
1432
1444
else "None"
1433
1445
)
You can’t perform that action at this time.
0 commit comments