Ejemplo n.º 1
0
def _int_(self):
    """Cast to an int32 tensor.

    Returns
    -------
    dragon.vm.torch.Tensor
        The self.

    """
    return array_funcs.cast(self, 'int32', True)
Ejemplo n.º 2
0
def half_(self):
    """Cast to a float16 tensor.

    Returns
    -------
    dragon.vm.torch.Tensor
        The self.

    """
    return array_funcs.cast(self, 'float16', True)
Ejemplo n.º 3
0
def _int(self):
    """Return an int32 tensor with the same data.

    Returns
    -------
    dragon.vm.torch.Tensor
        The output tensor.

    """
    return array_funcs.cast(self, 'int32', False)
Ejemplo n.º 4
0
def double_(self):
    """Cast to a float64 tensor.

    Returns
    -------
    dragon.vm.torch.Tensor
        The self.

    """
    return array_funcs.cast(self, 'float64', True)
Ejemplo n.º 5
0
def half(self):
    """Return a float16 tensor with the same data.

    Returns
    -------
    dragon.vm.torch.Tensor
        The output tensor.

    """
    return array_funcs.cast(self, 'float16', False)
Ejemplo n.º 6
0
def byte_(self):
    """Cast to an uint8 tensor.

    Returns
    -------
    dragon.vm.torch.Tensor
        The self.

    """
    return array_funcs.cast(self, 'uint8', True)
Ejemplo n.º 7
0
def byte(self):
    """Return an uint8 tensor with the same data.

    Returns
    -------
    dragon.vm.torch.Tensor
        The output tensor.

    """
    return array_funcs.cast(self, 'uint8', False)
Ejemplo n.º 8
0
def bool_(self):
    """Cast to a bool tensor.

    Returns
    -------
    dragon.vm.torch.Tensor
        The self.

    """
    return array_funcs.cast(self, 'bool', True)
Ejemplo n.º 9
0
def bool(self):
    """Return a bool tensor with the same data.

    Returns
    -------
    dragon.vm.torch.Tensor
        The output tensor.

    """
    return array_funcs.cast(self, 'bool', False)
Ejemplo n.º 10
0
def _type(self, dtype=None):
    """Return the data type.

    If ``dtype`` is not **None**, cast ``self`` to the new tensor.

    Parameters
    ----------
    dtype : str, optional
        The specified type.

    Returns
    -------
    Union[str, dragon.vm.torch.Tensor]
        The data type or new tensor.

    """
    if dtype is None:
        return self.dtype
    return array_funcs.cast(self, dtype, False)