neulab/docprompting-conala huggingface dataset:
detach()  
Returns a new Tensor, detached from the current graph. The result will never require gradient.  Note Returned Tensor shares the same storage with the original one. In-place modifications on either of them will be seen, and may trigger errors in correctness checks. IMPORTANT NOTE: Previously, in-place size / stride / storage changes (such as resize_ / resize_as_ / set_ / transpose_) to the returned tensor also update the original tensor. Now, these in-place changes will not update the original tensor anymore, and will instead trigger an error. For sparse tensors: In-place indices / values changes (such as zero_ / copy_ / add_) to the returned tensor will not update the original tensor anymore, and will instead trigger an error.
detach_()  
Detaches the Tensor from the graph that created it, making it a leaf. Views cannot be detached in-place.
diagonal(offset=0, dim1=0, dim2=1) → Tensor  
See torch.diagonal()
diag_embed(offset=0, dim1=-2, dim2=-1) → Tensor  
See torch.diag_embed()
diff(n=1, dim=-1, prepend=None, append=None) → Tensor  
See torch.diff()
div(value, *, rounding_mode=None) → Tensor  
See torch.div()
divide(value, *, rounding_mode=None) → Tensor  
See torch.divide()
divide_(value, *, rounding_mode=None) → Tensor  
In-place version of divide()
div_(value, *, rounding_mode=None) → Tensor  
In-place version of div()
double(memory_format=torch.preserve_format) → Tensor  
self.double() is equivalent to self.to(torch.float64). See to().  Parameters 
memory_format (torch.memory_format, optional) – the desired memory format of returned Tensor. Default: torch.preserve_format.
eig(eigenvectors=False) -> (Tensor, Tensor)  
See torch.eig()
element_size() → int  
Returns the size in bytes of an individual element. Example: >>> torch.tensor([]).element_size()
4
>>> torch.tensor([], dtype=torch.uint8).element_size()
1
expand(*sizes) → Tensor  
Returns a new view of the self tensor with singleton dimensions expanded to a larger size. Passing -1 as the size for a dimension means not changing the size of that dimension. Tensor can be also expanded to a larger number of dimensions, and the new ones will be appended at the front. For the new dimensions, the size cannot be set to -1. Expanding a tensor does not allocate new memory, but only creates a new view on the existing tensor where a dimension of size one is expanded to a larger size by setting the stride to 0. Any dimension of size 1 can be expanded to an arbitrary value without allocating new memory.  Parameters 
*sizes (torch.Size or int...) – the desired expanded size    Warning More than one element of an expanded tensor may refer to a single memory location. As a result, in-place operations (especially ones that are vectorized) may result in incorrect behavior. If you need to write to the tensors, please clone them first.  Example: >>> x = torch.tensor([[1], [2], [3]])
>>> x.size()
torch.Size([3, 1])
>>> x.expand(3, 4)
tensor([[ 1,  1,  1,  1],
        [ 2,  2,  2,  2],
        [ 3,  3,  3,  3]])
>>> x.expand(-1, 4)   # -1 means not changing the size of that dimension
tensor([[ 1,  1,  1,  1],
        [ 2,  2,  2,  2],
        [ 3,  3,  3,  3]])
expand_as(other) → Tensor  
Expand this tensor to the same size as other. self.expand_as(other) is equivalent to self.expand(other.size()). Please see expand() for more information about expand.  Parameters 
other (torch.Tensor) – The result tensor has the same size as other.
exponential_(lambd=1, *, generator=None) → Tensor  
Fills self tensor with elements drawn from the exponential distribution:  f(x)=λe−λxf(x) = \lambda e^{-\lambda x}
fill_diagonal_(fill_value, wrap=False) → Tensor  
Fill the main diagonal of a tensor that has at least 2-dimensions. When dims>2, all dimensions of input must be of equal length. This function modifies the input tensor in-place, and returns the input tensor.  Parameters 
 
fill_value (Scalar) – the fill value 
wrap (bool) – the diagonal ‘wrapped’ after N columns for tall matrices.    Example: >>> a = torch.zeros(3, 3)
>>> a.fill_diagonal_(5)
tensor([[5., 0., 0.],
        [0., 5., 0.],
        [0., 0., 5.]])
>>> b = torch.zeros(7, 3)
>>> b.fill_diagonal_(5)
tensor([[5., 0., 0.],
        [0., 5., 0.],
        [0., 0., 5.],
        [0., 0., 0.],
        [0., 0., 0.],
        [0., 0., 0.],
        [0., 0., 0.]])
>>> c = torch.zeros(7, 3)
>>> c.fill_diagonal_(5, wrap=True)
tensor([[5., 0., 0.],
        [0., 5., 0.],
        [0., 0., 5.],
        [0., 0., 0.],
        [5., 0., 0.],
        [0., 5., 0.],
        [0., 0., 5.]])
flatten(input, start_dim=0, end_dim=-1) → Tensor  
see torch.flatten()
float(memory_format=torch.preserve_format) → Tensor  
self.float() is equivalent to self.to(torch.float32). See to().  Parameters 
memory_format (torch.memory_format, optional) – the desired memory format of returned Tensor. Default: torch.preserve_format.
float_power_(exponent) → Tensor  
In-place version of float_power()
geometric_(p, *, generator=None) → Tensor  
Fills self tensor with elements drawn from the geometric distribution:  f(X=k)=pk−1(1−p)f(X=k) = p^{k - 1} (1 - p)
geqrf() -> (Tensor, Tensor)  
See torch.geqrf()
get_device() -> Device ordinal (Integer)  
For CUDA tensors, this function returns the device ordinal of the GPU on which the tensor resides. For CPU tensors, an error is thrown. Example: >>> x = torch.randn(3, 4, 5, device='cuda:0')
>>> x.get_device()
0
>>> x.cpu().get_device()  # RuntimeError: get_device is not implemented for type torch.FloatTensor
grad  
This attribute is None by default and becomes a Tensor the first time a call to backward() computes gradients for self. The attribute will then contain the gradients computed and future calls to backward() will accumulate (add) gradients into it.
half(memory_format=torch.preserve_format) → Tensor  
self.half() is equivalent to self.to(torch.float16). See to().  Parameters 
memory_format (torch.memory_format, optional) – the desired memory format of returned Tensor. Default: torch.preserve_format.
hardshrink(lambd=0.5) → Tensor  
See torch.nn.functional.hardshrink()
histc(bins=100, min=0, max=0) → Tensor  
See torch.histc()
imag  
Returns a new tensor containing imaginary values of the self tensor. The returned tensor and self share the same underlying storage.  Warning imag() 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.imag
tensor([ 0.3553, -0.7896, -0.0633, -0.8119])
index_add(tensor1, dim, index, tensor2) → Tensor  
Out-of-place version of torch.Tensor.index_add_(). tensor1 corresponds to self in torch.Tensor.index_add_().
index_add_(dim, index, tensor) → Tensor  
Accumulate the elements of tensor into the self tensor by adding to the indices in the order given in index. For example, if dim == 0 and index[i] == j, then the ith row of tensor is added to the jth row of self. The dimth dimension of tensor must have the same size as the length of index (which must be a vector), and all other dimensions must match self, or an error will be raised.  Note This operation may behave nondeterministically when given tensors on a CUDA device. See Reproducibility for more information.   Parameters 
 
dim (int) – dimension along which to index 
index (IntTensor or LongTensor) – indices of tensor to select from 
tensor (Tensor) – the tensor containing values to add    Example: >>> x = torch.ones(5, 3)
>>> t = torch.tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype=torch.float)
>>> index = torch.tensor([0, 4, 2])
>>> x.index_add_(0, index, t)
tensor([[  2.,   3.,   4.],
        [  1.,   1.,   1.],
        [  8.,   9.,  10.],
        [  1.,   1.,   1.],
        [  5.,   6.,   7.]])
index_copy(tensor1, dim, index, tensor2) → Tensor  
Out-of-place version of torch.Tensor.index_copy_(). tensor1 corresponds to self in torch.Tensor.index_copy_().
index_copy_(dim, index, tensor) → Tensor  
Copies the elements of tensor into the self tensor by selecting the indices in the order given in index. For example, if dim == 0 and index[i] == j, then the ith row of tensor is copied to the jth row of self. The dimth dimension of tensor must have the same size as the length of index (which must be a vector), and all other dimensions must match self, or an error will be raised.  Note If index contains duplicate entries, multiple elements from tensor will be copied to the same index of self. The result is nondeterministic since it depends on which copy occurs last.   Parameters 
 
dim (int) – dimension along which to index 
index (LongTensor) – indices of tensor to select from 
tensor (Tensor) – the tensor containing values to copy    Example: >>> x = torch.zeros(5, 3)
>>> t = torch.tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype=torch.float)
>>> index = torch.tensor([0, 4, 2])
>>> x.index_copy_(0, index, t)
tensor([[ 1.,  2.,  3.],
        [ 0.,  0.,  0.],
        [ 7.,  8.,  9.],
        [ 0.,  0.,  0.],
        [ 4.,  5.,  6.]])
index_fill(tensor1, dim, index, value) → Tensor  
Out-of-place version of torch.Tensor.index_fill_(). tensor1 corresponds to self in torch.Tensor.index_fill_().
index_fill_(dim, index, val) → Tensor  
Fills the elements of the self tensor with value val by selecting the indices in the order given in index.  Parameters 
 
dim (int) – dimension along which to index 
index (LongTensor) – indices of self tensor to fill in 
val (float) – the value to fill with     Example::

>>> x = torch.tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype=torch.float)
>>> index = torch.tensor([0, 2])
>>> x.index_fill_(1, index, -1)
tensor([[-1.,  2., -1.],
        [-1.,  5., -1.],
        [-1.,  8., -1.]])
index_put(tensor1, indices, values, accumulate=False) → Tensor  
Out-place version of index_put_(). tensor1 corresponds to self in torch.Tensor.index_put_().
index_put_(indices, values, accumulate=False) → Tensor  
Puts values from the tensor values into the tensor self using the indices specified in indices (which is a tuple of Tensors). The expression tensor.index_put_(indices, values) is equivalent to tensor[indices] = values. Returns self. If accumulate is True, the elements in values are added to self. If accumulate is False, the behavior is undefined if indices contain duplicate elements.  Parameters 
 
indices (tuple of LongTensor) – tensors used to index into self. 
values (Tensor) – tensor of same dtype as self. 
accumulate (bool) – whether to accumulate into self
indices() → Tensor  
Return the indices tensor of a sparse COO tensor.  Warning Throws an error if self is not a sparse COO tensor.  See also Tensor.values().  Note This method can only be called on a coalesced sparse tensor. See Tensor.coalesce() for details.
int(memory_format=torch.preserve_format) → Tensor  
self.int() is equivalent to self.to(torch.int32). See to().  Parameters 
memory_format (torch.memory_format, optional) – the desired memory format of returned Tensor. Default: torch.preserve_format.
int_repr() → Tensor  
Given a quantized Tensor, self.int_repr() returns a CPU Tensor with uint8_t as data type that stores the underlying uint8_t values of the given Tensor.
isclose(other, rtol=1e-05, atol=1e-08, equal_nan=False) → Tensor  
See torch.isclose()
istft(n_fft, hop_length=None, win_length=None, window=None, center=True, normalized=False, onesided=None, length=None, return_complex=False) [source]
 
See torch.istft()
is_coalesced() → bool  
Returns True if self is a sparse COO tensor that is coalesced, False otherwise.  Warning Throws an error if self is not a sparse COO tensor.  See coalesce() and uncoalesced tensors.
is_complex() → bool  
Returns True if the data type of self is a complex data type.
is_contiguous(memory_format=torch.contiguous_format) → bool  
Returns True if self tensor is contiguous in memory in the order specified by memory format.  Parameters 
memory_format (torch.memory_format, optional) – Specifies memory allocation order. Default: torch.contiguous_format.
is_floating_point() → bool  
Returns True if the data type of self is a floating point data type.
is_leaf  
All Tensors that have requires_grad which is False will be leaf Tensors by convention. For Tensors that have requires_grad which is True, they will be leaf Tensors if they were created by the user. This means that they are not the result of an operation and so grad_fn is None. Only leaf Tensors will have their grad populated during a call to backward(). To get grad populated for non-leaf Tensors, you can use retain_grad(). Example: >>> a = torch.rand(10, requires_grad=True)
>>> a.is_leaf
True
>>> b = torch.rand(10, requires_grad=True).cuda()
>>> b.is_leaf
False
# b was created by the operation that cast a cpu Tensor into a cuda Tensor
>>> c = torch.rand(10, requires_grad=True) + 2
>>> c.is_leaf
False
# c was created by the addition operation
>>> d = torch.rand(10).cuda()
>>> d.is_leaf
True
# d does not require gradients and so has no operation creating it (that is tracked by the autograd engine)
>>> e = torch.rand(10).cuda().requires_grad_()
>>> e.is_leaf
True
# e requires gradients and has no operations creating it
>>> f = torch.rand(10, requires_grad=True, device="cuda")
>>> f.is_leaf
True
# f requires grad, has no operation creating it
is_meta  
Is True if the Tensor is a meta tensor, False otherwise. Meta tensors are like normal tensors, but they carry no data.
is_set_to(tensor) → bool  
Returns True if both tensors are pointing to the exact same memory (same storage, offset, size and stride).
is_shared() [source]
 
Checks if tensor is in shared memory. This is always True for CUDA tensors.
is_signed() → bool  
Returns True if the data type of self is a signed data type.
item() → number  
Returns the value of this tensor as a standard Python number. This only works for tensors with one element. For other cases, see tolist(). This operation is not differentiable. Example: >>> x = torch.tensor([1.0])
>>> x.item()
1.0
kthvalue(k, dim=None, keepdim=False) -> (Tensor, LongTensor)  
See torch.kthvalue()
logcumsumexp(dim) → Tensor  
See torch.logcumsumexp()
logical_xor_() → Tensor  
In-place version of logical_xor()
logsumexp(dim, keepdim=False) → Tensor  
See torch.logsumexp()
log_normal_(mean=1, std=2, *, generator=None)  
Fills self tensor with numbers samples from the log-normal distribution parameterized by the given mean μ\mu  and standard deviation σ\sigma . Note that mean and std are the mean and standard deviation of the underlying normal distribution, and not of the returned distribution:  f(x)=1xσ2πe−(ln⁡x−μ)22σ2f(x) = \dfrac{1}{x \sigma \sqrt{2\pi}}\ e^{-\frac{(\ln x - \mu)^2}{2\sigma^2}}
long(memory_format=torch.preserve_format) → Tensor  
self.long() is equivalent to self.to(torch.int64). See to().  Parameters 
memory_format (torch.memory_format, optional) – the desired memory format of returned Tensor. Default: torch.preserve_format.
lstsq(A) -> (Tensor, Tensor)  
See torch.lstsq()
lu(pivot=True, get_infos=False) [source]
 
See torch.lu()
lu_solve(LU_data, LU_pivots) → Tensor  
See torch.lu_solve()
map_(tensor, callable)  
Applies callable for each element in self tensor and the given tensor and stores the results in self tensor. self tensor and the given tensor must be broadcastable. The callable should have the signature: def callable(a, b) -> number
masked_fill(mask, value) → Tensor  
Out-of-place version of torch.Tensor.masked_fill_()
masked_fill_(mask, value)  
Fills elements of self tensor with value where mask is True. The shape of mask must be broadcastable with the shape of the underlying tensor.  Parameters 
 
mask (BoolTensor) – the boolean mask 
value (float) – the value to fill in with
masked_scatter(mask, tensor) → Tensor  
Out-of-place version of torch.Tensor.masked_scatter_()
masked_scatter_(mask, source)  
Copies elements from source into self tensor at positions where the mask is True. The shape of mask must be broadcastable with the shape of the underlying tensor. The source should have at least as many elements as the number of ones in mask  Parameters 
 
mask (BoolTensor) – the boolean mask 
source (Tensor) – the tensor to copy from     Note The mask operates on the self tensor, not on the given source tensor.
max(dim=None, keepdim=False) -> Tensor or (Tensor, Tensor)  
See torch.max()
mean(dim=None, keepdim=False) -> Tensor or (Tensor, Tensor)  
See torch.mean()
median(dim=None, keepdim=False) -> (Tensor, LongTensor)  
See torch.median()
min(dim=None, keepdim=False) -> Tensor or (Tensor, Tensor)  
See torch.min()
mode(dim=None, keepdim=False) -> (Tensor, LongTensor)  
See torch.mode()
multinomial(num_samples, replacement=False, *, generator=None) → Tensor  
See torch.multinomial()
mvlgamma_(p) → Tensor  
In-place version of mvlgamma()
names  
Stores names for each of this tensor’s dimensions. names[idx] corresponds to the name of tensor dimension idx. Names are either a string if the dimension is named or None if the dimension is unnamed. Dimension names may contain characters or underscore. Furthermore, a dimension name must be a valid Python variable name (i.e., does not start with underscore). Tensors may not have two named dimensions with the same name.  Warning The named tensor API is experimental and subject to change.
nanmedian(dim=None, keepdim=False) -> (Tensor, LongTensor)  
See torch.nanmedian()
nanquantile(q, dim=None, keepdim=False) → Tensor  
See torch.nanquantile()
nansum(dim=None, keepdim=False, dtype=None) → Tensor  
See torch.nansum()
nan_to_num(nan=0.0, posinf=None, neginf=None) → Tensor  
See torch.nan_to_num().
nan_to_num_(nan=0.0, posinf=None, neginf=None) → Tensor  
In-place version of nan_to_num().
narrow(dimension, start, length) → Tensor  
See torch.narrow() Example: >>> x = torch.tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
>>> x.narrow(0, 0, 2)
tensor([[ 1,  2,  3],
        [ 4,  5,  6]])
>>> x.narrow(1, 1, 2)
tensor([[ 2,  3],
        [ 5,  6],
        [ 8,  9]])
narrow_copy(dimension, start, length) → Tensor  
Same as Tensor.narrow() except returning a copy rather than shared storage. This is primarily for sparse tensors, which do not have a shared-storage narrow method. Calling `narrow_copy with `dimemsion > self.sparse_dim()` will return a copy with the relevant dense dimension narrowed, and `self.shape` updated accordingly.
new_empty(size, dtype=None, device=None, requires_grad=False) → Tensor  
Returns a Tensor of size size filled with uninitialized data. By default, the returned Tensor has the same torch.dtype and torch.device as this tensor.  Parameters 
 
dtype (torch.dtype, optional) – the desired type of returned tensor. Default: if None, same torch.dtype as this tensor. 
device (torch.device, optional) – the desired device of returned tensor. Default: if None, same torch.device as this tensor. 
requires_grad (bool, optional) – If autograd should record operations on the returned tensor. Default: False.    Example: >>> tensor = torch.ones(())
>>> tensor.new_empty((2, 3))
tensor([[ 5.8182e-18,  4.5765e-41, -1.0545e+30],
        [ 3.0949e-41,  4.4842e-44,  0.0000e+00]])
new_full(size, fill_value, dtype=None, device=None, requires_grad=False) → Tensor  
Returns a Tensor of size size filled with fill_value. By default, the returned Tensor has the same torch.dtype and torch.device as this tensor.  Parameters 
 
fill_value (scalar) – the number to fill the output tensor with. 
dtype (torch.dtype, optional) – the desired type of returned tensor. Default: if None, same torch.dtype as this tensor. 
device (torch.device, optional) – the desired device of returned tensor. Default: if None, same torch.device as this tensor. 
requires_grad (bool, optional) – If autograd should record operations on the returned tensor. Default: False.    Example: >>> tensor = torch.ones((2,), dtype=torch.float64)
>>> tensor.new_full((3, 4), 3.141592)
tensor([[ 3.1416,  3.1416,  3.1416,  3.1416],
        [ 3.1416,  3.1416,  3.1416,  3.1416],
        [ 3.1416,  3.1416,  3.1416,  3.1416]], dtype=torch.float64)
new_ones(size, dtype=None, device=None, requires_grad=False) → Tensor  
Returns a Tensor of size size filled with 1. By default, the returned Tensor has the same torch.dtype and torch.device as this tensor.  Parameters 
 
size (int...) – a list, tuple, or torch.Size of integers defining the shape of the output tensor. 
dtype (torch.dtype, optional) – the desired type of returned tensor. Default: if None, same torch.dtype as this tensor. 
device (torch.device, optional) – the desired device of returned tensor. Default: if None, same torch.device as this tensor. 
requires_grad (bool, optional) – If autograd should record operations on the returned tensor. Default: False.    Example: >>> tensor = torch.tensor((), dtype=torch.int32)
>>> tensor.new_ones((2, 3))
tensor([[ 1,  1,  1],
        [ 1,  1,  1]], dtype=torch.int32)
new_tensor(data, dtype=None, device=None, requires_grad=False) → Tensor  
Returns a new Tensor with data as the tensor data. By default, the returned Tensor has the same torch.dtype and torch.device as this tensor.  Warning new_tensor() always copies data. If you have a Tensor data and want to avoid a copy, use torch.Tensor.requires_grad_() or torch.Tensor.detach(). If you have a numpy array and want to avoid a copy, use torch.from_numpy().   Warning When data is a tensor x, new_tensor() reads out ‘the data’ from whatever it is passed, and constructs a leaf variable. Therefore tensor.new_tensor(x) is equivalent to x.clone().detach() and tensor.new_tensor(x, requires_grad=True) is equivalent to x.clone().detach().requires_grad_(True). The equivalents using clone() and detach() are recommended.   Parameters 
 
data (array_like) – The returned Tensor copies data. 
dtype (torch.dtype, optional) – the desired type of returned tensor. Default: if None, same torch.dtype as this tensor. 
device (torch.device, optional) – the desired device of returned tensor. Default: if None, same torch.device as this tensor. 
requires_grad (bool, optional) – If autograd should record operations on the returned tensor. Default: False.    Example: >>> tensor = torch.ones((2,), dtype=torch.int8)
>>> data = [[0, 1], [2, 3]]
>>> tensor.new_tensor(data)
tensor([[ 0,  1],
        [ 2,  3]], dtype=torch.int8)
new_zeros(size, dtype=None, device=None, requires_grad=False) → Tensor  
Returns a Tensor of size size filled with 0. By default, the returned Tensor has the same torch.dtype and torch.device as this tensor.  Parameters 
 
size (int...) – a list, tuple, or torch.Size of integers defining the shape of the output tensor. 
dtype (torch.dtype, optional) – the desired type of returned tensor. Default: if None, same torch.dtype as this tensor. 
device (torch.device, optional) – the desired device of returned tensor. Default: if None, same torch.device as this tensor. 
requires_grad (bool, optional) – If autograd should record operations on the returned tensor. Default: False.    Example: >>> tensor = torch.tensor((), dtype=torch.float64)
>>> tensor.new_zeros((2, 3))
tensor([[ 0.,  0.,  0.],
        [ 0.,  0.,  0.]], dtype=torch.float64)
norm(p='fro', dim=None, keepdim=False, dtype=None) [source]
 
See torch.norm()
normal_(mean=0, std=1, *, generator=None) → Tensor  
Fills self tensor with elements samples from the normal distribution parameterized by mean and std.
numpy() → numpy.ndarray  
Returns self tensor as a NumPy ndarray. This tensor and the returned ndarray share the same underlying storage. Changes to self tensor will be reflected in the ndarray and vice versa.
ormqr(input2, input3, left=True, transpose=False) → Tensor  
See torch.ormqr()
permute(*dims) → Tensor  
Returns a view of the original tensor with its dimensions permuted.  Parameters 
*dims (int...) – The desired ordering of dimensions   Example >>> x = torch.randn(2, 3, 5)
>>> x.size()
torch.Size([2, 3, 5])
>>> x.permute(2, 0, 1).size()
torch.Size([5, 2, 3])
pin_memory() → Tensor  
Copies the tensor to pinned memory, if it’s not already pinned.
prod(dim=None, keepdim=False, dtype=None) → Tensor  
See torch.prod()