Skip to content

Commit 584e506

Browse files
committed
wrap with asarray
1 parent dd93f08 commit 584e506

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pytensor/scalar/basic.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,14 +1142,15 @@ def output_types(self, types):
11421142

11431143
def perform(self, node, inputs, output_storage):
11441144
if self.nout == 1:
1145-
output_storage[0][0] = self.impl(*inputs).astype(
1146-
node.outputs[0].dtype, copy=False
1145+
output_storage[0][0] = np.asarray(
1146+
self.impl(*inputs),
1147+
dtype=node.outputs[0].dtype,
11471148
)
11481149
else:
11491150
variables = from_return_values(self.impl(*inputs))
11501151
assert len(variables) == len(output_storage)
11511152
for out, storage, variable in zip(node.outputs, output_storage, variables):
1152-
storage[0] = variable.astype(out.dtype, copy=False)
1153+
storage[0] = np.asarray(variable, dtype=out.dtype)
11531154

11541155
def impl(self, *inputs):
11551156
raise MethodNotDefined("impl", type(self), self.__class__.__name__)

0 commit comments

Comments
 (0)