We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c04f04f commit bb75c17Copy full SHA for bb75c17
torch_np/_detail/implementations.py
@@ -612,7 +612,7 @@ def _flatten(tensor, order="C"):
612
if order != "C":
613
raise NotImplementedError
614
# return a copy
615
- result = tensor.ravel().clone()
+ result = tensor.flatten()
616
return result
617
618
@@ -645,10 +645,9 @@ def round(tensor, decimals=0):
645
646
647
def imag(tensor):
648
- try:
+ if tensor.is_complex():
649
result = tensor.imag
650
- except RuntimeError:
651
- # RuntimeError: imag is not implemented for tensors with non-complex dtypes.
+ else:
652
result = torch.zeros_like(tensor)
653
654
0 commit comments