neulab/docprompting-conala huggingface dataset:
put_(indices, tensor, accumulate=False) → Tensor  
Copies the elements from tensor into the positions specified by indices. For the purpose of indexing, the self tensor is treated as if it were a 1-D tensor. If accumulate is True, the elements in tensor are added to self. If accumulate is False, the behavior is undefined if indices contain duplicate elements.  Parameters 
 
indices (LongTensor) – the indices into self 
tensor (Tensor) – the tensor containing values to copy from 
accumulate (bool) – whether to accumulate into self    Example: >>> src = torch.tensor([[4, 3, 5],
...                     [6, 7, 8]])
>>> src.put_(torch.tensor([1, 3]), torch.tensor([9, 10]))
tensor([[  4,   9,   5],
        [ 10,   7,   8]])
qr(some=True) -> (Tensor, Tensor)  
See torch.qr()
qscheme() → torch.qscheme  
Returns the quantization scheme of a given QTensor.
quantile(q, dim=None, keepdim=False) → Tensor  
See torch.quantile()
q_per_channel_axis() → int  
Given a Tensor quantized by linear (affine) per-channel quantization, returns the index of dimension on which per-channel quantization is applied.
q_per_channel_scales() → Tensor  
Given a Tensor quantized by linear (affine) per-channel quantization, returns a Tensor of scales of the underlying quantizer. It has the number of elements that matches the corresponding dimensions (from q_per_channel_axis) of the tensor.
q_per_channel_zero_points() → Tensor  
Given a Tensor quantized by linear (affine) per-channel quantization, returns a tensor of zero_points of the underlying quantizer. It has the number of elements that matches the corresponding dimensions (from q_per_channel_axis) of the tensor.
q_scale() → float  
Given a Tensor quantized by linear(affine) quantization, returns the scale of the underlying quantizer().
q_zero_point() → int  
Given a Tensor quantized by linear(affine) quantization, returns the zero_point of the underlying quantizer().
random_(from=0, to=None, *, generator=None) → Tensor  
Fills self tensor with numbers sampled from the discrete uniform distribution over [from, to - 1]. If not specified, the values are usually only bounded by self tensor’s data type. However, for floating point types, if unspecified, range will be [0, 2^mantissa] to ensure that every value is representable. For example, torch.tensor(1, dtype=torch.double).random_() will be uniform in [0, 2^53].
real  
Returns a new tensor containing real values of the self tensor. The returned tensor and self share the same underlying storage.  Warning real() is only supported for tensors with complex dtypes.   Example::

>>> x=torch.randn(4, dtype=torch.cfloat)
>>> x
tensor([(0.3100+0.3553j), (-0.5445-0.7896j), (-1.6492-0.0633j), (-0.0638-0.8119j)])
>>> x.real
tensor([ 0.3100, -0.5445, -1.6492, -0.0638])
record_stream(stream)  
Ensures that the tensor memory is not reused for another tensor until all current work queued on stream are complete.  Note The caching allocator is aware of only the stream where a tensor was allocated. Due to the awareness, it already correctly manages the life cycle of tensors on only one stream. But if a tensor is used on a stream different from the stream of origin, the allocator might reuse the memory unexpectedly. Calling this method lets the allocator know which streams have used the tensor.
refine_names(*names) [source]
 
Refines the dimension names of self according to names. Refining is a special case of renaming that “lifts” unnamed dimensions. A None dim can be refined to have any name; a named dim can only be refined to have the same name. Because named tensors can coexist with unnamed tensors, refining names gives a nice way to write named-tensor-aware code that works with both named and unnamed tensors. names may contain up to one Ellipsis (...). The Ellipsis is expanded greedily; it is expanded in-place to fill names to the same length as self.dim() using names from the corresponding indices of self.names. Python 2 does not support Ellipsis but one may use a string literal instead ('...').  Parameters 
names (iterable of str) – The desired names of the output tensor. May contain up to one Ellipsis.   Examples: >>> imgs = torch.randn(32, 3, 128, 128)
>>> named_imgs = imgs.refine_names('N', 'C', 'H', 'W')
>>> named_imgs.names
('N', 'C', 'H', 'W')

>>> tensor = torch.randn(2, 3, 5, 7, 11)
>>> tensor = tensor.refine_names('A', ..., 'B', 'C')
>>> tensor.names
('A', None, None, 'B', 'C')
  Warning The named tensor API is experimental and subject to change.
register_hook(hook) [source]
 
Registers a backward hook. The hook will be called every time a gradient with respect to the Tensor is computed. The hook should have the following signature: hook(grad) -> Tensor or None
 The hook should not modify its argument, but it can optionally return a new gradient which will be used in place of grad. This function returns a handle with a method handle.remove() that removes the hook from the module. Example: >>> v = torch.tensor([0., 0., 0.], requires_grad=True)
>>> h = v.register_hook(lambda grad: grad * 2)  # double the gradient
>>> v.backward(torch.tensor([1., 2., 3.]))
>>> v.grad

 2
 4
 6
[torch.FloatTensor of size (3,)]

>>> h.remove()  # removes the hook
rename(*names, **rename_map) [source]
 
Renames dimension names of self. There are two main usages: self.rename(**rename_map) returns a view on tensor that has dims renamed as specified in the mapping rename_map. self.rename(*names) returns a view on tensor, renaming all dimensions positionally using names. Use self.rename(None) to drop names on a tensor. One cannot specify both positional args names and keyword args rename_map. Examples: >>> imgs = torch.rand(2, 3, 5, 7, names=('N', 'C', 'H', 'W'))
>>> renamed_imgs = imgs.rename(N='batch', C='channels')
>>> renamed_imgs.names
('batch', 'channels', 'H', 'W')

>>> renamed_imgs = imgs.rename(None)
>>> renamed_imgs.names
(None,)

>>> renamed_imgs = imgs.rename('batch', 'channel', 'height', 'width')
>>> renamed_imgs.names
('batch', 'channel', 'height', 'width')
  Warning The named tensor API is experimental and subject to change.
rename_(*names, **rename_map) [source]
 
In-place version of rename().
renorm(p, dim, maxnorm) → Tensor  
See torch.renorm()
renorm_(p, dim, maxnorm) → Tensor  
In-place version of renorm()
repeat(*sizes) → Tensor  
Repeats this tensor along the specified dimensions. Unlike expand(), this function copies the tensor’s data.  Warning repeat() behaves differently from numpy.repeat, but is more similar to numpy.tile. For the operator similar to numpy.repeat, see torch.repeat_interleave().   Parameters 
sizes (torch.Size or int...) – The number of times to repeat this tensor along each dimension   Example: >>> x = torch.tensor([1, 2, 3])
>>> x.repeat(4, 2)
tensor([[ 1,  2,  3,  1,  2,  3],
        [ 1,  2,  3,  1,  2,  3],
        [ 1,  2,  3,  1,  2,  3],
        [ 1,  2,  3,  1,  2,  3]])
>>> x.repeat(4, 2, 1).size()
torch.Size([4, 2, 3])
repeat_interleave(repeats, dim=None) → Tensor  
See torch.repeat_interleave().
requires_grad  
Is True if gradients need to be computed for this Tensor, False otherwise.  Note The fact that gradients need to be computed for a Tensor do not mean that the grad attribute will be populated, see is_leaf for more details.
requires_grad_(requires_grad=True) → Tensor  
Change if autograd should record operations on this tensor: sets this tensor’s requires_grad attribute in-place. Returns this tensor. requires_grad_()’s main use case is to tell autograd to begin recording operations on a Tensor tensor. If tensor has requires_grad=False (because it was obtained through a DataLoader, or required preprocessing or initialization), tensor.requires_grad_() makes it so that autograd will begin to record operations on tensor.  Parameters 
requires_grad (bool) – If autograd should record operations on this tensor. Default: True.   Example: >>> # Let's say we want to preprocess some saved weights and use
>>> # the result as new weights.
>>> saved_weights = [0.1, 0.2, 0.3, 0.25]
>>> loaded_weights = torch.tensor(saved_weights)
>>> weights = preprocess(loaded_weights)  # some function
>>> weights
tensor([-0.5503,  0.4926, -2.1158, -0.8303])

>>> # Now, start to record operations done to weights
>>> weights.requires_grad_()
>>> out = weights.pow(2).sum()
>>> out.backward()
>>> weights.grad
tensor([-1.1007,  0.9853, -4.2316, -1.6606])
reshape(*shape) → Tensor  
Returns a tensor with the same data and number of elements as self but with the specified shape. This method returns a view if shape is compatible with the current shape. See torch.Tensor.view() on when it is possible to return a view. See torch.reshape()  Parameters 
shape (tuple of python:ints or int...) – the desired shape
reshape_as(other) → Tensor  
Returns this tensor as the same shape as other. self.reshape_as(other) is equivalent to self.reshape(other.sizes()). This method returns a view if other.sizes() is compatible with the current shape. See torch.Tensor.view() on when it is possible to return a view. Please see reshape() for more information about reshape.  Parameters 
other (torch.Tensor) – The result tensor has the same shape as other.
resize_(*sizes, memory_format=torch.contiguous_format) → Tensor  
Resizes self tensor to the specified size. If the number of elements is larger than the current storage size, then the underlying storage is resized to fit the new number of elements. If the number of elements is smaller, the underlying storage is not changed. Existing elements are preserved but any new memory is uninitialized.  Warning This is a low-level method. The storage is reinterpreted as C-contiguous, ignoring the current strides (unless the target size equals the current size, in which case the tensor is left unchanged). For most purposes, you will instead want to use view(), which checks for contiguity, or reshape(), which copies data if needed. To change the size in-place with custom strides, see set_().   Parameters 
 
sizes (torch.Size or int...) – the desired size 
memory_format (torch.memory_format, optional) – the desired memory format of Tensor. Default: torch.contiguous_format. Note that memory format of self is going to be unaffected if self.size() matches sizes.    Example: >>> x = torch.tensor([[1, 2], [3, 4], [5, 6]])
>>> x.resize_(2, 2)
tensor([[ 1,  2],
        [ 3,  4]])
resize_as_(tensor, memory_format=torch.contiguous_format) → Tensor  
Resizes the self tensor to be the same size as the specified tensor. This is equivalent to self.resize_(tensor.size()).  Parameters 
memory_format (torch.memory_format, optional) – the desired memory format of Tensor. Default: torch.contiguous_format. Note that memory format of self is going to be unaffected if self.size() matches tensor.size().
retain_grad() [source]
 
Enables .grad attribute for non-leaf Tensors.
scatter(dim, index, src) → Tensor  
Out-of-place version of torch.Tensor.scatter_()
scatter_add(dim, index, src) → Tensor  
Out-of-place version of torch.Tensor.scatter_add_()
scatter_add_(dim, index, src) → Tensor  
Adds all values from the tensor other into self at the indices specified in the index tensor in a similar fashion as scatter_(). For each value in src, it is added to an index in self which is specified by its index in src for dimension != dim and by the corresponding value in index for dimension = dim. For a 3-D tensor, self is updated as: self[index[i][j][k]][j][k] += src[i][j][k]  # if dim == 0
self[i][index[i][j][k]][k] += src[i][j][k]  # if dim == 1
self[i][j][index[i][j][k]] += src[i][j][k]  # if dim == 2
 self, index and src should have same number of dimensions. It is also required that index.size(d) <= src.size(d) for all dimensions d, and that index.size(d) <= self.size(d) for all dimensions d != dim. Note that index and src do not broadcast.  Note This operation may behave nondeterministically when given tensors on a CUDA device. See Reproducibility for more information.   Note The backward pass is implemented only for src.shape == index.shape.   Parameters 
 
dim (int) – the axis along which to index 
index (LongTensor) – the indices of elements to scatter and add, can be either empty or of the same dimensionality as src. When empty, the operation returns self unchanged. 
src (Tensor) – the source elements to scatter and add    Example: >>> src = torch.ones((2, 5))
>>> index = torch.tensor([[0, 1, 2, 0, 0]])
>>> torch.zeros(3, 5, dtype=src.dtype).scatter_add_(0, index, src)
tensor([[1., 0., 0., 1., 1.],
        [0., 1., 0., 0., 0.],
        [0., 0., 1., 0., 0.]])
>>> index = torch.tensor([[0, 1, 2, 0, 0], [0, 1, 2, 2, 2]])
>>> torch.zeros(3, 5, dtype=src.dtype).scatter_add_(0, index, src)
tensor([[2., 0., 0., 1., 1.],
        [0., 2., 0., 0., 0.],
        [0., 0., 2., 1., 1.]])
select(dim, index) → Tensor  
Slices the self tensor along the selected dimension at the given index. This function returns a view of the original tensor with the given dimension removed.  Parameters 
 
dim (int) – the dimension to slice 
index (int) – the index to select with     Note select() is equivalent to slicing. For example, tensor.select(0, index) is equivalent to tensor[index] and tensor.select(2, index) is equivalent to tensor[:,:,index].
set_(source=None, storage_offset=0, size=None, stride=None) → Tensor  
Sets the underlying storage, size, and strides. If source is a tensor, self tensor will share the same storage and have the same size and strides as source. Changes to elements in one tensor will be reflected in the other. If source is a Storage, the method sets the underlying storage, offset, size, and stride.  Parameters 
 
source (Tensor or Storage) – the tensor or storage to use 
storage_offset (int, optional) – the offset in the storage 
size (torch.Size, optional) – the desired size. Defaults to the size of the source. 
stride (tuple, optional) – the desired stride. Defaults to C-contiguous strides.
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.
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.
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])
slogdet() -> (Tensor, Tensor)  
See torch.slogdet()
sort(dim=-1, descending=False) -> (Tensor, LongTensor)  
See torch.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.
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, even when the corresponding values in self are zeros.   Parameters 
mask (Tensor) – a sparse tensor whose indices are used as a filter   Example: >>> nse = 5
>>> dims = (5, 5, 2, 2)
>>> I = torch.cat([torch.randint(0, dims[0], size=(nse,)),
...                torch.randint(0, dims[1], size=(nse,))], 0).reshape(2, nse)
>>> V = torch.randn(nse, dims[2], dims[3])
>>> S = torch.sparse_coo_tensor(I, V, dims).coalesce()
>>> D = torch.randn(dims)
>>> D.sparse_mask(S)
tensor(indices=tensor([[0, 0, 0, 2],
                       [0, 1, 4, 3]]),
       values=tensor([[[ 1.6550,  0.2397],
                       [-0.1611, -0.0779]],

                      [[ 0.2326, -1.0558],
                       [ 1.4711,  1.9678]],

                      [[-0.5138, -0.0411],
                       [ 1.9417,  0.5158]],

                      [[ 0.0793,  0.0036],
                       [-0.2569, -0.1055]]]),
       size=(5, 5, 2, 2), nnz=4, layout=torch.sparse_coo)
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 +
dense_dim. If self specifies one or more elements, however, then each dimension in size must not be smaller than the corresponding dimension of self, sparse_dim must equal the number of sparse dimensions in self, and dense_dim must equal the number of dense dimensions in self.   Warning Throws an error if self is not a sparse tensor.   Parameters 
 
size (torch.Size) – the desired size. If self is non-empty sparse tensor, the desired size cannot be smaller than the original size. 
sparse_dim (int) – the number of sparse dimensions 
dense_dim (int) – the number of dense dimensions
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_dim (int) – the number of dense dimensions
split(split_size, dim=0) [source]
 
See torch.split()
std(dim=None, unbiased=True, keepdim=False) → Tensor  
See torch.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.
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
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.  Parameters 
dim (int, optional) – the desired dimension in which stride is required   Example: >>> x = torch.tensor([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]])
>>> x.stride()
(5, 1)
>>> x.stride(0)
5
>>> x.stride(-1)
1
subtract_(other, *, alpha=1) → Tensor  
In-place version of subtract().
sub_(other, *, alpha=1) → Tensor  
In-place version of sub()
sum(dim=None, keepdim=False, dtype=None) → Tensor  
See torch.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.
svd(some=True, compute_uv=True) -> (Tensor, Tensor, Tensor)  
See torch.svd()
swapaxes(axis0, axis1) → Tensor  
See torch.swapaxes()
swapdims(dim0, dim1) → Tensor  
See torch.swapdims()
symeig(eigenvectors=False, upper=True) -> (Tensor, Tensor)  
See torch.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).
tensor_split(indices_or_sections, dim=0) → List of Tensors  
See torch.tensor_split()
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 self with the desired torch.dtype and torch.device.  Here are the ways to call to:  
to(dtype, non_blocking=False, copy=False, memory_format=torch.preserve_format) → Tensor  
Returns a Tensor with the specified dtype  Args:

memory_format (torch.memory_format, optional): the desired memory format of returned Tensor. Default: torch.preserve_format.   
  
to(device=None, dtype=None, non_blocking=False, copy=False, memory_format=torch.preserve_format) → Tensor  
Returns a Tensor with the specified device and (optional) dtype. If dtype is None it is inferred to be self.dtype. When non_blocking, tries to convert asynchronously with respect to the host if possible, e.g., converting a CPU Tensor with pinned memory to a CUDA Tensor. When copy is set, a new Tensor is created even when the Tensor already matches the desired conversion.  Args:

memory_format (torch.memory_format, optional): the desired memory format of returned Tensor. Default: torch.preserve_format.   
  
to(other, non_blocking=False, copy=False) → Tensor  
Returns a Tensor with same torch.dtype and torch.device as the Tensor other. When non_blocking, tries to convert asynchronously with respect to the host if possible, e.g., converting a CPU Tensor with pinned memory to a CUDA Tensor. When copy is set, a new Tensor is created even when the Tensor already matches the desired conversion. 
 Example: >>> tensor = torch.randn(2, 2)  # Initially dtype=float32, device=cpu
>>> tensor.to(torch.float64)
tensor([[-0.5044,  0.0005],
        [ 0.3310, -0.0584]], dtype=torch.float64)

>>> cuda0 = torch.device('cuda:0')
>>> tensor.to(cuda0)
tensor([[-0.5044,  0.0005],
        [ 0.3310, -0.0584]], device='cuda:0')

>>> tensor.to(cuda0, dtype=torch.float64)
tensor([[-0.5044,  0.0005],
        [ 0.3310, -0.0584]], dtype=torch.float64, device='cuda:0')

>>> other = torch.randn((), dtype=torch.float64, device=cuda0)
>>> tensor.to(other, non_blocking=True)
tensor([[-0.5044,  0.0005],
        [ 0.3310, -0.0584]], dtype=torch.float64, device='cuda:0')
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.5415473580360413],
 [-0.08909505605697632, 0.7729271650314331]]
>>> a[0,0].tolist()
0.012766935862600803
topk(k, dim=None, largest=True, sorted=True) -> (Tensor, LongTensor)  
See torch.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],
        [ 9,  0, 10],
        [ 0,  0,  0]])
to_mkldnn() → Tensor  
Returns a copy of the tensor in torch.mkldnn layout.
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,  0,  0],
        [ 9,  0, 10],
        [ 0,  0,  0]])
>>> d.to_sparse()
tensor(indices=tensor([[1, 1],
                       [0, 2]]),
       values=tensor([ 9, 10]),
       size=(3, 3), nnz=2, layout=torch.sparse_coo)
>>> d.to_sparse(1)
tensor(indices=tensor([[1]]),
       values=tensor([[ 9,  0, 10]]),
       size=(3, 3), nnz=1, layout=torch.sparse_coo)
triangular_solve(A, upper=True, transpose=False, unitriangular=False) -> (Tensor, Tensor)  
See torch.triangular_solve()
true_divide_(value) → Tensor  
In-place version of true_divide_()
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_blocking (bool) – If True, and the source is in pinned memory and destination is on the GPU or vice versa, the copy is performed asynchronously with respect to the host. Otherwise, the argument has no effect. 
**kwargs – For compatibility, may contain the key async in place of the non_blocking argument. The async arg is deprecated.