Skip to content

Commit b016053

Browse files
committed
fixup for rtensor
1 parent 1211974 commit b016053

File tree

1 file changed

+5
-3
lines changed
  • bindings/pyroot/pythonizations/python/ROOT/_pythonization/_tmva

1 file changed

+5
-3
lines changed

bindings/pyroot/pythonizations/python/ROOT/_pythonization/_tmva/_rtensor.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,15 @@ def get_array_interface(self):
8585
idx1 = cppname.find("RTensor<")
8686
idx2 = cppname.find(",", idx1)
8787
dtype = cppname[idx1 + 8 : idx2]
88-
# dtype_numpy = _array_interface_dtype_map[dtype]
8988
for numpy_dtype, type_info in _numpy_dtype_typeinfo_map.items():
9089
if dtype == type_info["cpp"] or dtype == type_info["typedef"]:
9190
dtype_numpy = numpy_dtype
9291
dtype_size = cppyy.sizeof(dtype)
9392
break
94-
dtype_size = cppyy.sizeof(dtype)
93+
94+
if dtype_numpy:
95+
raise RuntimeError(f"Unsupported dtype '{dtype}' found in RTensor.")
96+
9597
endianness = "<" if sys.byteorder == "little" else ">"
9698
shape = self.GetShape()
9799
strides = self.GetStrides()
@@ -103,7 +105,7 @@ def get_array_interface(self):
103105
return {
104106
"shape": tuple(s for s in shape),
105107
"strides": tuple(s * dtype_size for s in strides),
106-
"typestr": "{}{}{}".format(endianness, dtype_numpy, dtype_size),
108+
"typestr": "{}{}".format(endianness, dtype_numpy),
107109
"version": 3,
108110
"data": (pointer, False),
109111
}

0 commit comments

Comments
 (0)