@@ -730,7 +730,6 @@ def is_dynamic(self) -> bool:
730
730
# fn is the function to call if executing outside a language context
731
731
@staticmethod
732
732
def _elementwise_unary_helper (a , name , fn , type_promotion_kind = None ):
733
-
734
733
vala = pyval (a )
735
734
736
735
trace : None | TraceCtx = get_tracectx ()
@@ -2063,18 +2062,28 @@ def type_string(self) -> str:
2063
2062
base_str = f"{ self .device .device_str ()} { self .dtype .shortname ()} { list (self ._shape )} "
2064
2063
2065
2064
if self ._subclass_type is not None :
2066
- type_str = f"{ self ._subclass_type .__name__ } of { base_str } "
2065
+ type_str = f"{ self ._subclass_type .__name__ } [ { base_str } ] "
2067
2066
else :
2068
2067
type_str = base_str
2069
2068
2070
2069
if self ._tensors :
2071
- if ( tensor_attr_names := getattr (self , "_tensor_attr_names" , []) ):
2072
- tensor_attr_type_str = ", " .join ([
2073
- f"{ name } : { t .type_string ()} " for name , t in zip (tensor_attr_names , self ._tensors )
2074
- ] )
2070
+ if tensor_attr_names := getattr (self , "_tensor_attr_names" , []):
2071
+ tensor_attr_type_str = ", " .join (
2072
+ [ f"{ name } : { t .type_string ()} " for name , t in zip (tensor_attr_names , self ._tensors )]
2073
+ )
2075
2074
else :
2076
2075
tensor_attr_type_str = ", " .join ([t .type_string () for t in self ._tensors ])
2077
- type_str = type_str + f" ({ tensor_attr_type_str } )"
2076
+
2077
+ if self ._non_tensors :
2078
+ if non_tensor_attr_names := getattr (self , "_non_tensor_attr_names" , []):
2079
+ non_tensor_attr_type_str = ", " .join (
2080
+ [f"{ name } : { v } " for name , v in zip (non_tensor_attr_names , self ._non_tensors )]
2081
+ )
2082
+ else :
2083
+ non_tensor_attr_type_str = ", " .join (str (v ) for v in self ._non_tensors )
2084
+ type_str = type_str + f" (tensors: { tensor_attr_type_str } , constants: { non_tensor_attr_type_str } )"
2085
+ else :
2086
+ type_str = type_str + f" ({ tensor_attr_type_str } )"
2078
2087
2079
2088
return type_str
2080
2089
0 commit comments