doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
sgn_() β†’ Tensor In-place version of sgn()
torch.tensors#torch.Tensor.sgn_
share_memory_() [source] Moves the underlying storage to shared memory. This is a no-op if the underlying storage is already in shared memory and for CUDA tensors. Tensors in shared memory cannot be resized.
torch.tensors#torch.Tensor.share_memory_
short(memory_format=torch.preserve_format) β†’ Tensor self.short() is equivalent to self.to(torch.int16). See to(). Parameters memory_format (torch.memory_format, optional) – the desired memory format of returned Tensor. Default: torch.preserve_format.
torch.tensors#torch.Tensor.short
sigmoid() β†’ Tensor See torch.sigmoid()
torch.tensors#torch.Tensor.sigmoid
sigmoid_() β†’ Tensor In-place version of sigmoid()
torch.tensors#torch.Tensor.sigmoid_
sign() β†’ Tensor See torch.sign()
torch.tensors#torch.Tensor.sign
signbit() β†’ Tensor See torch.signbit()
torch.tensors#torch.Tensor.signbit
sign_() β†’ Tensor In-place version of sign()
torch.tensors#torch.Tensor.sign_
sin() β†’ Tensor See torch.sin()
torch.tensors#torch.Tensor.sin
sinc() β†’ Tensor See torch.sinc()
torch.tensors#torch.Tensor.sinc
sinc_() β†’ Tensor In-place version of sinc()
torch.tensors#torch.Tensor.sinc_
sinh() β†’ Tensor See torch.sinh()
torch.tensors#torch.Tensor.sinh
sinh_() β†’ Tensor In-place version of sinh()
torch.tensors#torch.Tensor.sinh_
sin_() β†’ Tensor In-place version of sin()
torch.tensors#torch.Tensor.sin_
size() β†’ torch.Size Returns the size of the self tensor. The returned value is a subclass of tuple. Example: >>> torch.empty(3, 4, 5).size() torch.Size([3, 4, 5])
torch.tensors#torch.Tensor.size
slogdet() -> (Tensor, Tensor) See torch.slogdet()
torch.tensors#torch.Tensor.slogdet
solve(A) β†’ Tensor, Tensor See torch.solve()
torch.tensors#torch.Tensor.solve
sort(dim=-1, descending=False) -> (Tensor, LongTensor) See torch.sort()
torch.tensors#torch.Tensor.sort
sparse_dim() β†’ int Return the number of sparse dimensions in a sparse tensor self. Warning Throws an error if self is not a sparse tensor. See also Tensor.dense_dim() and hybrid tensors.
torch.sparse#torch.Tensor.sparse_dim
sparse_mask(mask) β†’ Tensor Returns a new sparse tensor with values from a strided tensor self filtered by the indices of the sparse tensor mask. The values of mask sparse tensor are ignored. self and mask tensors must have the same shape. Note The returned sparse tensor has the same indices as the sparse tensor mask...
torch.sparse#torch.Tensor.sparse_mask
sparse_resize_(size, sparse_dim, dense_dim) β†’ Tensor Resizes self sparse tensor to the desired size and the number of sparse and dense dimensions. Note If the number of specified elements in self is zero, then size, sparse_dim, and dense_dim can be any size and positive integers such that len(size) == sparse_dim + d...
torch.sparse#torch.Tensor.sparse_resize_
sparse_resize_and_clear_(size, sparse_dim, dense_dim) β†’ Tensor Removes all specified elements from a sparse tensor self and resizes self to the desired size and the number of sparse and dense dimensions. Parameters size (torch.Size) – the desired size. sparse_dim (int) – the number of sparse dimensions dense_di...
torch.sparse#torch.Tensor.sparse_resize_and_clear_
split(split_size, dim=0) [source] See torch.split()
torch.tensors#torch.Tensor.split
sqrt() β†’ Tensor See torch.sqrt()
torch.tensors#torch.Tensor.sqrt
sqrt_() β†’ Tensor In-place version of sqrt()
torch.tensors#torch.Tensor.sqrt_
square() β†’ Tensor See torch.square()
torch.tensors#torch.Tensor.square
square_() β†’ Tensor In-place version of square()
torch.tensors#torch.Tensor.square_
squeeze(dim=None) β†’ Tensor See torch.squeeze()
torch.tensors#torch.Tensor.squeeze
squeeze_(dim=None) β†’ Tensor In-place version of squeeze()
torch.tensors#torch.Tensor.squeeze_
std(dim=None, unbiased=True, keepdim=False) β†’ Tensor See torch.std()
torch.tensors#torch.Tensor.std
stft(n_fft, hop_length=None, win_length=None, window=None, center=True, pad_mode='reflect', normalized=False, onesided=None, return_complex=None) [source] See torch.stft() Warning This function changed signature at version 0.4.1. Calling with the previous signature may cause error or return incorrect result.
torch.tensors#torch.Tensor.stft
storage() β†’ torch.Storage Returns the underlying storage.
torch.tensors#torch.Tensor.storage
storage_offset() β†’ int Returns self tensor’s offset in the underlying storage in terms of number of storage elements (not bytes). Example: >>> x = torch.tensor([1, 2, 3, 4, 5]) >>> x.storage_offset() 0 >>> x[3:].storage_offset() 3
torch.tensors#torch.Tensor.storage_offset
storage_type() β†’ type Returns the type of the underlying storage.
torch.tensors#torch.Tensor.storage_type
stride(dim) β†’ tuple or int Returns the stride of self tensor. Stride is the jump necessary to go from one element to the next one in the specified dimension dim. A tuple of all strides is returned when no argument is passed in. Otherwise, an integer value is returned as the stride in the particular dimension dim. Pa...
torch.tensors#torch.Tensor.stride
sub(other, *, alpha=1) β†’ Tensor See torch.sub().
torch.tensors#torch.Tensor.sub
subtract(other, *, alpha=1) β†’ Tensor See torch.subtract().
torch.tensors#torch.Tensor.subtract
subtract_(other, *, alpha=1) β†’ Tensor In-place version of subtract().
torch.tensors#torch.Tensor.subtract_
sub_(other, *, alpha=1) β†’ Tensor In-place version of sub()
torch.tensors#torch.Tensor.sub_
sum(dim=None, keepdim=False, dtype=None) β†’ Tensor See torch.sum()
torch.tensors#torch.Tensor.sum
sum_to_size(*size) β†’ Tensor Sum this tensor to size. size must be broadcastable to this tensor size. Parameters size (int...) – a sequence of integers defining the shape of the output tensor.
torch.tensors#torch.Tensor.sum_to_size
svd(some=True, compute_uv=True) -> (Tensor, Tensor, Tensor) See torch.svd()
torch.tensors#torch.Tensor.svd
swapaxes(axis0, axis1) β†’ Tensor See torch.swapaxes()
torch.tensors#torch.Tensor.swapaxes
swapdims(dim0, dim1) β†’ Tensor See torch.swapdims()
torch.tensors#torch.Tensor.swapdims
symeig(eigenvectors=False, upper=True) -> (Tensor, Tensor) See torch.symeig()
torch.tensors#torch.Tensor.symeig
T Is this Tensor with its dimensions reversed. If n is the number of dimensions in x, x.T is equivalent to x.permute(n-1, n-2, ..., 0).
torch.tensors#torch.Tensor.T
t() β†’ Tensor See torch.t()
torch.tensors#torch.Tensor.t
take(indices) β†’ Tensor See torch.take()
torch.tensors#torch.Tensor.take
tan() β†’ Tensor See torch.tan()
torch.tensors#torch.Tensor.tan
tanh() β†’ Tensor See torch.tanh()
torch.tensors#torch.Tensor.tanh
tanh_() β†’ Tensor In-place version of tanh()
torch.tensors#torch.Tensor.tanh_
tan_() β†’ Tensor In-place version of tan()
torch.tensors#torch.Tensor.tan_
tensor_split(indices_or_sections, dim=0) β†’ List of Tensors See torch.tensor_split()
torch.tensors#torch.Tensor.tensor_split
tile(*reps) β†’ Tensor See torch.tile()
torch.tensors#torch.Tensor.tile
to(*args, **kwargs) β†’ Tensor Performs Tensor dtype and/or device conversion. A torch.dtype and torch.device are inferred from the arguments of self.to(*args, **kwargs). Note If the self Tensor already has the correct torch.dtype and torch.device, then self is returned. Otherwise, the returned tensor is a copy of sel...
torch.tensors#torch.Tensor.to
tolist() β†’ list or number 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.5...
torch.tensors#torch.Tensor.tolist
topk(k, dim=None, largest=True, sorted=True) -> (Tensor, LongTensor) See torch.topk()
torch.tensors#torch.Tensor.topk
to_dense() β†’ Tensor Creates a strided copy of self. Warning Throws an error if self is a strided tensor. Example: >>> s = torch.sparse_coo_tensor( ... torch.tensor([[1, 1], ... [0, 2]]), ... torch.tensor([9, 10]), ... size=(3, 3)) >>> s.to_dense() tensor([[ 0, 0, 0], ...
torch.sparse#torch.Tensor.to_dense
to_mkldnn() β†’ Tensor Returns a copy of the tensor in torch.mkldnn layout.
torch.tensors#torch.Tensor.to_mkldnn
to_sparse(sparseDims) β†’ Tensor Returns a sparse copy of the tensor. PyTorch supports sparse tensors in coordinate format. Parameters sparseDims (int, optional) – the number of sparse dimensions to include in the new sparse tensor Example: >>> d = torch.tensor([[0, 0, 0], [9, 0, 10], [0, 0, 0]]) >>> d tensor([[ 0,...
torch.sparse#torch.Tensor.to_sparse
trace() β†’ Tensor See torch.trace()
torch.tensors#torch.Tensor.trace
transpose(dim0, dim1) β†’ Tensor See torch.transpose()
torch.tensors#torch.Tensor.transpose
transpose_(dim0, dim1) β†’ Tensor In-place version of transpose()
torch.tensors#torch.Tensor.transpose_
triangular_solve(A, upper=True, transpose=False, unitriangular=False) -> (Tensor, Tensor) See torch.triangular_solve()
torch.tensors#torch.Tensor.triangular_solve
tril(k=0) β†’ Tensor See torch.tril()
torch.tensors#torch.Tensor.tril
tril_(k=0) β†’ Tensor In-place version of tril()
torch.tensors#torch.Tensor.tril_
triu(k=0) β†’ Tensor See torch.triu()
torch.tensors#torch.Tensor.triu
triu_(k=0) β†’ Tensor In-place version of triu()
torch.tensors#torch.Tensor.triu_
true_divide(value) β†’ Tensor See torch.true_divide()
torch.tensors#torch.Tensor.true_divide
true_divide_(value) β†’ Tensor In-place version of true_divide_()
torch.tensors#torch.Tensor.true_divide_
trunc() β†’ Tensor See torch.trunc()
torch.tensors#torch.Tensor.trunc
trunc_() β†’ Tensor In-place version of trunc()
torch.tensors#torch.Tensor.trunc_
type(dtype=None, non_blocking=False, **kwargs) β†’ str or Tensor Returns the type if dtype is not provided, else casts this object to the specified type. If this is already of the correct type, no copy is performed and the original object is returned. Parameters dtype (type or string) – The desired type non_blocki...
torch.tensors#torch.Tensor.type
type_as(tensor) β†’ Tensor Returns this tensor cast to the type of the given tensor. This is a no-op if the tensor is already of the correct type. This is equivalent to self.type(tensor.type()) Parameters tensor (Tensor) – the tensor which has the desired type
torch.tensors#torch.Tensor.type_as
t_() β†’ Tensor In-place version of t()
torch.tensors#torch.Tensor.t_
unbind(dim=0) β†’ seq See torch.unbind()
torch.tensors#torch.Tensor.unbind
unflatten(dim, sizes) [source] Expands the dimension dim of the self tensor over multiple dimensions of sizes given by sizes. sizes is the new shape of the unflattened dimension and it can be a Tuple[int] as well as torch.Size if self is a Tensor, or namedshape (Tuple[(name: str, size: int)]) if self is a NamedTens...
torch.named_tensor#torch.Tensor.unflatten
unfold(dimension, size, step) β†’ Tensor Returns a view of the original tensor which contains all slices of size size from self tensor in the dimension dimension. Step between two slices is given by step. If sizedim is the size of dimension dimension for self, the size of dimension dimension in the returned tensor will...
torch.tensors#torch.Tensor.unfold
uniform_(from=0, to=1) β†’ Tensor Fills self tensor with numbers sampled from the continuous uniform distribution: P(x)=1toβˆ’fromP(x) = \dfrac{1}{\text{to} - \text{from}}
torch.tensors#torch.Tensor.uniform_
unique(sorted=True, return_inverse=False, return_counts=False, dim=None) [source] Returns the unique elements of the input tensor. See torch.unique()
torch.tensors#torch.Tensor.unique
unique_consecutive(return_inverse=False, return_counts=False, dim=None) [source] Eliminates all but the first element from every consecutive group of equivalent elements. See torch.unique_consecutive()
torch.tensors#torch.Tensor.unique_consecutive
unsqueeze(dim) β†’ Tensor See torch.unsqueeze()
torch.tensors#torch.Tensor.unsqueeze
unsqueeze_(dim) β†’ Tensor In-place version of unsqueeze()
torch.tensors#torch.Tensor.unsqueeze_
values() β†’ Tensor Return the values tensor of a sparse COO tensor. Warning Throws an error if self is not a sparse COO tensor. See also Tensor.indices(). Note This method can only be called on a coalesced sparse tensor. See Tensor.coalesce() for details.
torch.sparse#torch.Tensor.values
var(dim=None, unbiased=True, keepdim=False) β†’ Tensor See torch.var()
torch.tensors#torch.Tensor.var
vdot(other) β†’ Tensor See torch.vdot()
torch.tensors#torch.Tensor.vdot
view(*shape) β†’ Tensor Returns a new tensor with the same data as the self tensor but of a different shape. The returned tensor shares the same data and must have the same number of elements, but may have a different size. For a tensor to be viewed, the new view size must be compatible with its original size and strid...
torch.tensors#torch.Tensor.view
view_as(other) β†’ Tensor View this tensor as the same size as other. self.view_as(other) is equivalent to self.view(other.size()). Please see view() for more information about view. Parameters other (torch.Tensor) – The result tensor has the same size as other.
torch.tensors#torch.Tensor.view_as
where(condition, y) β†’ Tensor self.where(condition, y) is equivalent to torch.where(condition, self, y). See torch.where()
torch.tensors#torch.Tensor.where
xlogy(other) β†’ Tensor See torch.xlogy()
torch.tensors#torch.Tensor.xlogy
xlogy_(other) β†’ Tensor In-place version of xlogy()
torch.tensors#torch.Tensor.xlogy_
zero_() β†’ Tensor Fills self tensor with zeros.
torch.tensors#torch.Tensor.zero_
torch.tensordot(a, b, dims=2, out=None) [source] Returns a contraction of a and b over multiple dimensions. tensordot implements a generalized matrix product. Parameters a (Tensor) – Left tensor to contract b (Tensor) – Right tensor to contract dims (int or Tuple[List[int]] containing two lists) – number of dim...
torch.generated.torch.tensordot#torch.tensordot
torch.tensor_split(input, indices_or_sections, dim=0) β†’ List of Tensors Splits a tensor into multiple sub-tensors, all of which are views of input, along dimension dim according to the indices or number of sections specified by indices_or_sections. This function is based on NumPy’s numpy.array_split(). Parameters ...
torch.generated.torch.tensor_split#torch.tensor_split
torch.tile(input, reps) β†’ Tensor Constructs a tensor by repeating the elements of input. The reps argument specifies the number of repetitions in each dimension. If reps specifies fewer dimensions than input has, then ones are prepended to reps until all dimensions are specified. For example, if input has shape (8, 6...
torch.generated.torch.tile#torch.tile
torch.topk(input, k, dim=None, largest=True, sorted=True, *, out=None) -> (Tensor, LongTensor) Returns the k largest elements of the given input tensor along a given dimension. If dim is not given, the last dimension of the input is chosen. If largest is False then the k smallest elements are returned. A namedtuple o...
torch.generated.torch.topk#torch.topk
torch.default_generator Returns the default CPU torch.Generator
torch#torch.torch.default_generator
class torch.device
torch.tensor_attributes#torch.torch.device
class torch.dtype
torch.tensor_attributes#torch.torch.dtype
class torch.finfo
torch.type_info#torch.torch.finfo