File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
onnxscript/ir/_convenience Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -95,9 +95,16 @@ def tensor(
95
95
# Plain Python object
96
96
if dtype is not None :
97
97
numpy_dtype = dtype .numpy ()
98
+ elif isinstance (value , int ) and not isinstance (value , bool ):
99
+ # Specify int64 for ints because on Windows this may be int32
100
+ numpy_dtype = np .dtype (np .int64 )
98
101
elif isinstance (value , float ):
99
102
# If the value is a single float, we use np.float32 as the default dtype
100
103
numpy_dtype = np .dtype (np .float32 )
104
+ elif isinstance (value , Sequence ) and all (
105
+ (isinstance (elem , int ) and not isinstance (value , bool )) for elem in value
106
+ ):
107
+ numpy_dtype = np .dtype (np .int64 )
101
108
elif isinstance (value , Sequence ) and all (isinstance (elem , float ) for elem in value ):
102
109
# If the value is a sequence of floats, we use np.float32 as the default dtype
103
110
numpy_dtype = np .dtype (np .float32 )
You can’t perform that action at this time.
0 commit comments