torchoutil.types.tensor_subclasses module¶
Tensor subclasses for typing and instance checks.
Note: torchoutil.FloatTensor != torch.FloatTensor but issubclass(torchoutil.FloatTensor, torch.FloatTensor) is False because torch.FloatTensor cannot be subclassed
- Here is an overview of the valid tensor subclasses tree:
- Tensor
- ComplexFloatingTensor FloatingTensor IntegralTensor
- | |
+————+————+ +———–+———–+ +——————+——————+ | | | | | | | |
- CHalfTensor CFloatTensor CDoubleTensor HalfTensor FloatTensor DoubleTensor SignedIntegerTensor UnsignedIntegerTensor
- (c32) (c64) (c128) (f16) (f32) (f64) | |
+———–+—–+—–+———–+ +—–+—–+ | | | | | |
- CharTensor ShortTensor IntTensor LongTensor ByteTensor BoolTensor
(i8) (i16) (i32) (i64) (u8) (bool)
- class BoolTensor(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class BoolTensor(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.bool: ‘bool’>],int,bool,Literal[0],Literal[0],Literal[0]]
- class BoolTensor0D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class BoolTensor0D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.bool: ‘bool’>],Literal[0],bool,Literal[0],Literal[0],Literal[0]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class BoolTensor1D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class BoolTensor1D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.bool: ‘bool’>],Literal[1],bool,Literal[0],Literal[0],Literal[0]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class BoolTensor2D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class BoolTensor2D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.bool: ‘bool’>],Literal[2],bool,Literal[0],Literal[0],Literal[0]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class BoolTensor3D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class BoolTensor3D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.bool: ‘bool’>],Literal[3],bool,Literal[0],Literal[0],Literal[0]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class ByteTensor(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class ByteTensor(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.uint8: ‘uint8’>],int,int,Literal[0],Literal[0],Literal[0]]
- class ByteTensor0D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class ByteTensor0D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.uint8: ‘uint8’>],Literal[0],int,Literal[0],Literal[0],Literal[0]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class ByteTensor1D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class ByteTensor1D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.uint8: ‘uint8’>],Literal[1],int,Literal[0],Literal[0],Literal[0]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class ByteTensor2D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class ByteTensor2D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.uint8: ‘uint8’>],Literal[2],int,Literal[0],Literal[0],Literal[0]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class ByteTensor3D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class ByteTensor3D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.uint8: ‘uint8’>],Literal[3],int,Literal[0],Literal[0],Literal[0]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class CDoubleTensor(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class CDoubleTensor(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.complex128: ‘complex128’>],int,complex,Literal[0],Literal[1],Literal[1]]
- class CDoubleTensor0D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class CDoubleTensor0D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.complex128: ‘complex128’>],Literal[0],complex,Literal[0],Literal[1],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class CDoubleTensor1D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class CDoubleTensor1D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.complex128: ‘complex128’>],Literal[1],complex,Literal[0],Literal[1],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class CDoubleTensor2D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class CDoubleTensor2D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.complex128: ‘complex128’>],Literal[2],complex,Literal[0],Literal[1],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class CDoubleTensor3D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class CDoubleTensor3D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.complex128: ‘complex128’>],Literal[3],complex,Literal[0],Literal[1],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class CFloatTensor(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class CFloatTensor(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.complex64: ‘complex64’>],int,complex,Literal[0],Literal[1],Literal[1]]
- class CFloatTensor0D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class CFloatTensor0D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.complex64: ‘complex64’>],Literal[0],complex,Literal[0],Literal[1],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class CFloatTensor1D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class CFloatTensor1D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.complex64: ‘complex64’>],Literal[1],complex,Literal[0],Literal[1],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class CFloatTensor2D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class CFloatTensor2D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.complex64: ‘complex64’>],Literal[2],complex,Literal[0],Literal[1],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class CFloatTensor3D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class CFloatTensor3D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.complex64: ‘complex64’>],Literal[3],complex,Literal[0],Literal[1],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class CHalfTensor(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class CHalfTensor(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.complex32: ‘complex32’>],int,complex,Literal[0],Literal[1],Literal[1]]
- class CHalfTensor0D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class CHalfTensor0D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.complex32: ‘complex32’>],Literal[0],complex,Literal[0],Literal[1],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class CHalfTensor1D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class CHalfTensor1D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.complex32: ‘complex32’>],Literal[1],complex,Literal[0],Literal[1],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class CHalfTensor2D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class CHalfTensor2D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.complex32: ‘complex32’>],Literal[2],complex,Literal[0],Literal[1],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class CHalfTensor3D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class CHalfTensor3D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.complex32: ‘complex32’>],Literal[3],complex,Literal[0],Literal[1],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class CharTensor(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class CharTensor(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.int8: ‘int8’>],int,int,Literal[0],Literal[0],Literal[1]]
- class CharTensor0D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class CharTensor0D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.int8: ‘int8’>],Literal[0],int,Literal[0],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class CharTensor1D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class CharTensor1D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.int8: ‘int8’>],Literal[1],int,Literal[0],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class CharTensor2D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class CharTensor2D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.int8: ‘int8’>],Literal[2],int,Literal[0],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class CharTensor3D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class CharTensor3D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.int8: ‘int8’>],Literal[3],int,Literal[0],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class ComplexFloatingTensor(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class ComplexFloatingTensor(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],int,complex,Literal[0],Literal[1],Literal[1]]Intermediate class for checking and typing complex-valued tensors. - Concrete subclasses are: CFloatTensor, CHalfTensor, CDoubleTensor. - Properties are: is_floating_point=False, is_complex=True, is_signed=True. - By default, instantiate this class will create a CFloatTensor.
- class ComplexFloatingTensor0D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class ComplexFloatingTensor0D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[0],complex,Literal[0],Literal[1],Literal[1]]
- class ComplexFloatingTensor1D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class ComplexFloatingTensor1D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[1],complex,Literal[0],Literal[1],Literal[1]]
- class ComplexFloatingTensor2D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class ComplexFloatingTensor2D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[2],complex,Literal[0],Literal[1],Literal[1]]
- class ComplexFloatingTensor3D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class ComplexFloatingTensor3D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[3],complex,Literal[0],Literal[1],Literal[1]]
- class DoubleTensor(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class DoubleTensor(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.float64: ‘float64’>],int,float,Literal[1],Literal[0],Literal[1]]
- class DoubleTensor0D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class DoubleTensor0D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.float64: ‘float64’>],Literal[0],float,Literal[1],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class DoubleTensor1D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class DoubleTensor1D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.float64: ‘float64’>],Literal[1],float,Literal[1],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class DoubleTensor2D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class DoubleTensor2D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.float64: ‘float64’>],Literal[2],float,Literal[1],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class DoubleTensor3D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class DoubleTensor3D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.float64: ‘float64’>],Literal[3],float,Literal[1],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class FloatTensor(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class FloatTensor(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.float32: ‘float32’>],int,float,Literal[1],Literal[0],Literal[1]]
- class FloatTensor0D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class FloatTensor0D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.float32: ‘float32’>],Literal[0],float,Literal[1],Literal[0],Literal[1]]
- class FloatTensor1D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class FloatTensor1D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.float32: ‘float32’>],Literal[1],float,Literal[1],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class FloatTensor2D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class FloatTensor2D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.float32: ‘float32’>],Literal[2],float,Literal[1],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class FloatTensor3D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class FloatTensor3D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.float32: ‘float32’>],Literal[3],float,Literal[1],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class FloatingTensor(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class FloatingTensor(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],int,float,Literal[1],Literal[0],Literal[1]]Intermediate class for checking and typing floating-point tensors. - Concrete subclasses are: FloatTensor, HalfTensor, DoubleTensor. - Properties are: is_floating_point=True, is_complex=False, is_signed=True. - By default, instantiate this class will create a FloatTensor.
- class FloatingTensor0D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class FloatingTensor0D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[0],float,Literal[1],Literal[0],Literal[1]]
- class FloatingTensor1D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class FloatingTensor1D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[1],float,Literal[1],Literal[0],Literal[1]]
- class FloatingTensor2D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class FloatingTensor2D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[2],float,Literal[1],Literal[0],Literal[1]]
- class FloatingTensor3D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class FloatingTensor3D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[3],float,Literal[1],Literal[0],Literal[1]]
- class HalfTensor(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class HalfTensor(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.float16: ‘float16’>],int,float,Literal[1],Literal[0],Literal[1]]
- class HalfTensor0D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class HalfTensor0D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.float16: ‘float16’>],Literal[0],float,Literal[1],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class HalfTensor1D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class HalfTensor1D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.float16: ‘float16’>],Literal[1],float,Literal[1],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class HalfTensor2D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class HalfTensor2D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.float16: ‘float16’>],Literal[2],float,Literal[1],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class HalfTensor3D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class HalfTensor3D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.float16: ‘float16’>],Literal[3],float,Literal[1],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class IntTensor(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class IntTensor(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.int32: ‘int32’>],int,int,Literal[0],Literal[0],Literal[1]]
- class IntTensor0D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class IntTensor0D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.int32: ‘int32’>],Literal[0],int,Literal[0],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class IntTensor1D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class IntTensor1D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.int32: ‘int32’>],Literal[1],int,Literal[0],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class IntTensor2D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class IntTensor2D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.int32: ‘int32’>],Literal[2],int,Literal[0],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class IntTensor3D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class IntTensor3D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.int32: ‘int32’>],Literal[3],int,Literal[0],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class IntegralTensor(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class IntegralTensor(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],int,int,Literal[0],Literal[0],bool]Intermediate class for checking and typing integer data type (integer-like) tensors. - Concrete subclasses are: CharTensor, ShortTensor, IntTensor, LongTensor, BoolTensor, ByteTensor. - Properties are: is_floating_point=False, is_complex=False. - By default, instantiate this class will create an LongTensor. - BoolTensor is a subclass of UnsignedIntegerTensor.
- class IntegralTensor0D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class IntegralTensor0D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[0],int,Literal[0],Literal[0],bool]
- class IntegralTensor1D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class IntegralTensor1D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[1],int,Literal[0],Literal[0],bool]
- class IntegralTensor2D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class IntegralTensor2D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[2],int,Literal[0],Literal[0],bool]
- class IntegralTensor3D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class IntegralTensor3D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[3],int,Literal[0],Literal[0],bool]
- class LongTensor(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class LongTensor(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.int64: ‘int64’>],int,int,Literal[0],Literal[0],Literal[1]]
- class LongTensor0D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class LongTensor0D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.int64: ‘int64’>],Literal[0],int,Literal[0],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class LongTensor1D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class LongTensor1D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.int64: ‘int64’>],Literal[1],int,Literal[0],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class LongTensor2D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class LongTensor2D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.int64: ‘int64’>],Literal[2],int,Literal[0],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class LongTensor3D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class LongTensor3D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.int64: ‘int64’>],Literal[3],int,Literal[0],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class ShortTensor(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class ShortTensor(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.int16: ‘int16’>],int,int,Literal[0],Literal[0],Literal[1]]
- class ShortTensor0D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class ShortTensor0D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.int16: ‘int16’>],Literal[0],int,Literal[0],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class ShortTensor1D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class ShortTensor1D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.int16: ‘int16’>],Literal[1],int,Literal[0],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class ShortTensor2D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class ShortTensor2D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.int16: ‘int16’>],Literal[2],int,Literal[0],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class ShortTensor3D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class ShortTensor3D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[<DTypeEnum.int16: ‘int16’>],Literal[3],int,Literal[0],Literal[0],Literal[1]]- tolist() list or number[source]¶
Returns the tensor as a (nested) list. For scalars, a standard Python number is returned, just like with
item(). Tensors are automatically moved to the CPU first if necessary.This operation is not differentiable.
Examples:
>>> a = torch.randn(2, 2) >>> a.tolist() [[0.012766935862600803, 0.5415473580360413], [-0.08909505605697632, 0.7729271650314331]] >>> a[0,0].tolist() 0.012766935862600803
- class SignedIntegerTensor(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class SignedIntegerTensor(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],int,int,Literal[0],Literal[0],Literal[1]]Intermediate class for checking and typing signed integer data type (integer-like) tensors. - Concrete subclasses are: IntTensor, LongTensor, ShortTensor. - Properties are: is_floating_point=False, is_complex=False, is_signed=True. - By default, instantiate this class will create an IntTensor. - BoolTensor is not a subclass of SignedIntegerTensor because it is not signed.
- class SignedIntegerTensor0D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class SignedIntegerTensor0D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[0],int,Literal[0],Literal[0],Literal[1]]
- class SignedIntegerTensor1D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class SignedIntegerTensor1D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[1],int,Literal[0],Literal[0],Literal[1]]
- class SignedIntegerTensor2D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class SignedIntegerTensor2D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[2],int,Literal[0],Literal[0],Literal[1]]
- class SignedIntegerTensor3D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class SignedIntegerTensor3D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[3],int,Literal[0],Literal[0],Literal[1]]
- class Tensor(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class Tensor(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],int,Union[bool,int,float,complex],bool,bool,bool]
- class Tensor0D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class Tensor0D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[0],Union[bool,int,float,complex],bool,bool,bool]
- class Tensor1D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class Tensor1D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[1],Union[bool,int,float,complex],bool,bool,bool]
- class Tensor2D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class Tensor2D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[2],Union[bool,int,float,complex],bool,bool,bool]
- class Tensor3D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class Tensor3D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[3],Union[bool,int,float,complex],bool,bool,bool]
- class UnsignedIntegerTensor(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class UnsignedIntegerTensor(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],int,int,Literal[0],Literal[0],Literal[0]]Intermediate class for checking and typing unsigned integer data type (integer-like) tensors. - Concrete subclasses are: BoolTensor, ByteTensor. - Properties are: is_floating_point=False, is_complex=False, is_signed=False. - By default, instantiate this class will create an ByteTensor. - BoolTensor is a subclass of UnsignedIntegerTensor.
- class UnsignedIntegerTensor0D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class UnsignedIntegerTensor0D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[0],int,Literal[0],Literal[0],Literal[0]]
- class UnsignedIntegerTensor1D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class UnsignedIntegerTensor1D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[1],int,Literal[0],Literal[0],Literal[0]]
- class UnsignedIntegerTensor2D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class UnsignedIntegerTensor2D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[2],int,Literal[0],Literal[0],Literal[0]]
- class UnsignedIntegerTensor3D(
- *dims: int,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
- memory_format: memory_format | None = None,
- out: Tensor | None = None,
- layout: layout | None = None,
- pin_memory: bool | None = False,
- requires_grad: bool | None = False,
- class UnsignedIntegerTensor3D(
- data: T_BuiltinNumber | Sequence,
- /,
- *,
- dtype: dtype | None | Literal['default'] | str | DTypeEnum = None,
- device: device | None | Literal['default', 'cuda_if_available'] | str | int = None,
Bases:
_TensorNDBase[Literal[None],Literal[3],int,Literal[0],Literal[0],Literal[0]]