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
As @lukasheinrich pointed out in PR #944, enforcing a shape of (1,) on tensors created from floats is probably not a good idea when none of the backends do this
>>>importpyhf>>>importnumpyasnp>>>>>>example=np.asarray(0.1)
>>>print(f"example {example} is a {type(example)} with shape {example.shape}")
example0.1isa<class'numpy.ndarray'>withshape ()
>>>pyhf.set_backend("numpy")
>>>example=pyhf.tensorlib.astensor(0.1)
>>>print(f"example {example} is a {type(example)} with shape {example.shape}")
example [0.1] isa<class'numpy.ndarray'>withshape (1,)
So we should make sure that we match the shape here
# make this soassertnp.asarray(0.1).shape==pyhf.tensorlib.astensor(0.1).shape
The text was updated successfully, but these errors were encountered:
It seems that we implemented this behavior in PR #413 because of MXNet. 🙃 Given that we don't support MXNet anymore I think there's no reason that we shouldn't implement @lukasheinrich's suggestion, as I think Issue #288 won't pop up again.
matthewfeickert
changed the title
Don't enforce a non-zero shape on tensors
Don't enforce a non-empty shape on tensors
Jul 17, 2020
Description
As @lukasheinrich pointed out in PR #944, enforcing a shape of
(1,)
on tensors created from floats is probably not a good idea when none of the backends do thisSo we should make sure that we match the shape here
The text was updated successfully, but these errors were encountered: