You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Do not pass the dtype to asarray because we want this to fail if
# strict is True and the types do not match.
rval=ScalarSharedVariable(
type=tensor_type,
value=np.array(value, copy=True),
name=name,
strict=strict,
allow_downcast=allow_downcast,
)
returnrval
This is an empty subclass created when doing shared(5). Internally, it behaves exactly like a shared 0d tensor variable shared(np.array(5)). In fact calling shared(shared(5).get_value()) will return a TensorSharedVariable from the original ScalarSharedVariable.
There exists a true ScalarSharedVariable with scalar operators in
We should probably not use that when a user calls shared(5), but I don't see any reason for the tensor.ScalarSharedVariable either. Just do the same checks as we have now but return the same type as shared(np.array(5)).
This would be as if type(pytensor.tensor.scalar()) returned a dummy subclass of TensorVariable confusingly called ScalarVariable (it does not).
The text was updated successfully, but these errors were encountered:
pytensor/pytensor/tensor/sharedvar.py
Lines 97 to 142 in 673c1ac
This is an empty subclass created when doing
shared(5)
. Internally, it behaves exactly like a shared 0d tensor variableshared(np.array(5))
. In fact callingshared(shared(5).get_value())
will return aTensorSharedVariable
from the originalScalarSharedVariable
.There exists a true
ScalarSharedVariable
with scalar operators inpytensor/pytensor/scalar/sharedvar.py
Lines 25 to 61 in 673c1ac
We should probably not use that when a user calls
shared(5)
, but I don't see any reason for thetensor.ScalarSharedVariable
either. Just do the same checks as we have now but return the same type asshared(np.array(5))
.This would be as if
type(pytensor.tensor.scalar())
returned a dummy subclass ofTensorVariable
confusingly calledScalarVariable
(it does not).The text was updated successfully, but these errors were encountered: