Skip to content

Commit

Permalink
wrap with asarray
Browse files Browse the repository at this point in the history
  • Loading branch information
ferrine committed Aug 13, 2024
1 parent dd93f08 commit 584e506
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pytensor/scalar/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1142,14 +1142,15 @@ def output_types(self, types):

def perform(self, node, inputs, output_storage):
if self.nout == 1:
output_storage[0][0] = self.impl(*inputs).astype(
node.outputs[0].dtype, copy=False
output_storage[0][0] = np.asarray(
self.impl(*inputs),
dtype=node.outputs[0].dtype,
)
else:
variables = from_return_values(self.impl(*inputs))
assert len(variables) == len(output_storage)
for out, storage, variable in zip(node.outputs, output_storage, variables):
storage[0] = variable.astype(out.dtype, copy=False)
storage[0] = np.asarray(variable, dtype=out.dtype)

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

0 comments on commit 584e506

Please sign in to comment.