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
While one could argue that an empty tuple is not a tuple of integers, it could still be worth it to explicitly state that the behavior with axis=() is unspecificed and thus implementation-defined.
IRL, it is implementation-defined:
In [5]: a = np.arange(3*4*5).reshape(3, 4, 5)
In [6]: np.count_nonzero(a, axis=()).shape
Out[6]: (3, 4, 5)
In [7]: torch.count_nonzero(torch.as_tensor(a), dim=())
Out[7]: tensor(59)
In fact, it'd be best to add the same phrasing to all reduction-like functions which accept tuples for axis.