def copysign(self, other) -> Tensor:
    """
    Returns a tensor of with the magnitude of `self` and the sign of `other`, elementwise.
    """
    # NOTE: torch always return in float, we return based on the broadcasting rule.
    other = self._broadcasted(other)[1]
    # TODO: remove other*0?
    return (other < 0).where(-self.abs(), self.abs()) + other*0

    Returns a tensor of with the magnitude of `self` and the sign of `other`, elementwise.
    
tinygrad/tensor.py