| 2057 | return torch.max(torch.stack(torch.broadcast_tensors(a, b)), axis=0)[0] |
| 2058 | |
| 2059 | def minimum(self, a, b): |
| 2060 | if isinstance(a, int) or isinstance(a, float): |
| 2061 | a = torch.tensor([float(a)], dtype=b.dtype, device=b.device) |
| 2062 | if isinstance(b, int) or isinstance(b, float): |
| 2063 | b = torch.tensor([float(b)], dtype=a.dtype, device=a.device) |
| 2064 | if hasattr(torch, "minimum"): |
| 2065 | return torch.minimum(a, b) |
| 2066 | else: |
| 2067 | return torch.min(torch.stack(torch.broadcast_tensors(a, b)), axis=0)[0] |
| 2068 | |
| 2069 | def sign(self, a): |
| 2070 | return torch.sign(a) |