def any(x, axis=None):
if axis is None and torch.is_tensor(x):
return x.bool().any()
numpy_result = _np.array(_np.any(_np.array(x), axis=axis))
return torch.from_numpy(numpy_result)
def cast(x, dtype):
if torch.is_tensor(x):
After Change
def any(x, axis=None):
if not torch.is_tensor(x):
x = torch.tensor(x)
if axis is None:
return x.bool().any()
return torch.any(x.bool(), axis=axis)
//numpy_result = _np.array(_np.any(_np.array(x), axis=axis))