neulab/docprompting-conala huggingface dataset:
torch.nan_to_num(input, nan=0.0, posinf=None, neginf=None, *, out=None) → Tensor  
Replaces NaN, positive infinity, and negative infinity values in input with the values specified by nan, posinf, and neginf, respectively. By default, NaN`s are replaced with zero, positive infinity is replaced with the
greatest finite value representable by :attr:`input’s dtype, and negative infinity is replaced with the least finite value representable by input’s dtype.  Parameters 
 
input (Tensor) – the input tensor. 
nan (Number, optional) – the value to replace NaNs with. Default is zero. 
posinf (Number, optional) – if a Number, the value to replace positive infinity values with. If None, positive infinity values are replaced with the greatest finite value representable by input’s dtype. Default is None. 
neginf (Number, optional) – if a Number, the value to replace negative infinity values with. If None, negative infinity values are replaced with the lowest finite value representable by input’s dtype. Default is None.   Keyword Arguments 
out (Tensor, optional) – the output tensor.   Example: >>> x = torch.tensor([float('nan'), float('inf'), -float('inf'), 3.14])
>>> torch.nan_to_num(x)
tensor([ 0.0000e+00,  3.4028e+38, -3.4028e+38,  3.1400e+00])
>>> torch.nan_to_num(x, nan=2.0)
tensor([ 2.0000e+00,  3.4028e+38, -3.4028e+38,  3.1400e+00])
>>> torch.nan_to_num(x, nan=2.0, posinf=1.0)
tensor([ 2.0000e+00,  1.0000e+00, -3.4028e+38,  3.1400e+00])
torch.narrow(input, dim, start, length) → Tensor  
Returns a new tensor that is a narrowed version of input tensor. The dimension dim is input from start to start + length. The returned tensor and input tensor share the same underlying storage.  Parameters 
 
input (Tensor) – the tensor to narrow 
dim (int) – the dimension along which to narrow 
start (int) – the starting dimension 
length (int) – the distance to the ending dimension    Example: >>> x = torch.tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
>>> torch.narrow(x, 0, 0, 2)
tensor([[ 1,  2,  3],
        [ 4,  5,  6]])
>>> torch.narrow(x, 1, 1, 2)
tensor([[ 2,  3],
        [ 5,  6],
        [ 8,  9]])
torch.ne(input, other, *, out=None) → Tensor  
Computes input≠other\text{input} \neq \text{other}  element-wise. The second argument can be a number or a tensor whose shape is broadcastable with the first argument.  Parameters 
 
input (Tensor) – the tensor to compare 
other (Tensor or float) – the tensor or value to compare   Keyword Arguments 
out (Tensor, optional) – the output tensor.  Returns 
A boolean tensor that is True where input is not equal to other and False elsewhere   Example: >>> torch.ne(torch.tensor([[1, 2], [3, 4]]), torch.tensor([[1, 1], [4, 4]]))
tensor([[False, True], [True, False]])
torch.neg(input, *, out=None) → Tensor  
Returns a new tensor with the negative of the elements of input.  out=−1×input\text{out} = -1 \times \text{input}  
 Parameters 
input (Tensor) – the input tensor.  Keyword Arguments 
out (Tensor, optional) – the output tensor.   Example: >>> a = torch.randn(5)
>>> a
tensor([ 0.0090, -0.2262, -0.0682, -0.2866,  0.3940])
>>> torch.neg(a)
tensor([-0.0090,  0.2262,  0.0682,  0.2866, -0.3940])
torch.negative(input, *, out=None) → Tensor  
Alias for torch.neg()
torch.nextafter(input, other, *, out=None) → Tensor  
Return the next floating-point value after input towards other, elementwise. The shapes of input and other must be broadcastable.  Parameters 
 
input (Tensor) – the first input tensor 
other (Tensor) – the second input tensor   Keyword Arguments 
out (Tensor, optional) – the output tensor.    Example::

>>> eps = torch.finfo(torch.float32).eps
>>> torch.nextafter(torch.Tensor([1, 2]), torch.Tensor([2, 1])) == torch.Tensor([eps + 1, 2 - eps])
tensor([True, True])
class torch.nn.AdaptiveAvgPool1d(output_size) [source]
 
Applies a 1D adaptive average pooling over an input signal composed of several input planes. The output size is H, for any input size. The number of output features is equal to the number of input planes.  Parameters 
output_size – the target output size H   Examples >>> # target output size of 5
>>> m = nn.AdaptiveAvgPool1d(5)
>>> input = torch.randn(1, 64, 8)
>>> output = m(input)
class torch.nn.AdaptiveAvgPool2d(output_size) [source]
 
Applies a 2D adaptive average pooling over an input signal composed of several input planes. The output is of size H x W, for any input size. The number of output features is equal to the number of input planes.  Parameters 
output_size – the target output size of the image of the form H x W. Can be a tuple (H, W) or a single H for a square image H x H. H and W can be either a int, or None which means the size will be the same as that of the input.   Examples >>> # target output size of 5x7
>>> m = nn.AdaptiveAvgPool2d((5,7))
>>> input = torch.randn(1, 64, 8, 9)
>>> output = m(input)
>>> # target output size of 7x7 (square)
>>> m = nn.AdaptiveAvgPool2d(7)
>>> input = torch.randn(1, 64, 10, 9)
>>> output = m(input)
>>> # target output size of 10x7
>>> m = nn.AdaptiveAvgPool2d((None, 7))
>>> input = torch.randn(1, 64, 10, 9)
>>> output = m(input)
class torch.nn.AdaptiveAvgPool3d(output_size) [source]
 
Applies a 3D adaptive average pooling over an input signal composed of several input planes. The output is of size D x H x W, for any input size. The number of output features is equal to the number of input planes.  Parameters 
output_size – the target output size of the form D x H x W. Can be a tuple (D, H, W) or a single number D for a cube D x D x D. D, H and W can be either a int, or None which means the size will be the same as that of the input.   Examples >>> # target output size of 5x7x9
>>> m = nn.AdaptiveAvgPool3d((5,7,9))
>>> input = torch.randn(1, 64, 8, 9, 10)
>>> output = m(input)
>>> # target output size of 7x7x7 (cube)
>>> m = nn.AdaptiveAvgPool3d(7)
>>> input = torch.randn(1, 64, 10, 9, 8)
>>> output = m(input)
>>> # target output size of 7x9x8
>>> m = nn.AdaptiveAvgPool3d((7, None, None))
>>> input = torch.randn(1, 64, 10, 9, 8)
>>> output = m(input)
log_prob(input) [source]
 
Computes log probabilities for all n_classes\texttt{n\_classes}   Parameters 
input (Tensor) – a minibatch of examples  Returns 
log-probabilities of for each class cc  in range 0<=c<=n_classes0 <= c <= \texttt{n\_classes} , where n_classes\texttt{n\_classes}  is a parameter passed to AdaptiveLogSoftmaxWithLoss constructor.    Shape:

 Input: (N,in_features)(N, \texttt{in\_features}) 
 Output: (N,n_classes)(N, \texttt{n\_classes})
predict(input) [source]
 
This is equivalent to self.log_pob(input).argmax(dim=1), but is more efficient in some cases.  Parameters 
input (Tensor) – a minibatch of examples  Returns 
a class with the highest probability for each example  Return type 
output (Tensor)    Shape:

 Input: (N,in_features)(N, \texttt{in\_features}) 
 Output: (N)(N)
class torch.nn.AdaptiveMaxPool1d(output_size, return_indices=False) [source]
 
Applies a 1D adaptive max pooling over an input signal composed of several input planes. The output size is H, for any input size. The number of output features is equal to the number of input planes.  Parameters 
 
output_size – the target output size H 
return_indices – if True, will return the indices along with the outputs. Useful to pass to nn.MaxUnpool1d. Default: False
    Examples >>> # target output size of 5
>>> m = nn.AdaptiveMaxPool1d(5)
>>> input = torch.randn(1, 64, 8)
>>> output = m(input)
class torch.nn.AdaptiveMaxPool2d(output_size, return_indices=False) [source]
 
Applies a 2D adaptive max pooling over an input signal composed of several input planes. The output is of size H x W, for any input size. The number of output features is equal to the number of input planes.  Parameters 
 
output_size – the target output size of the image of the form H x W. Can be a tuple (H, W) or a single H for a square image H x H. H and W can be either a int, or None which means the size will be the same as that of the input. 
return_indices – if True, will return the indices along with the outputs. Useful to pass to nn.MaxUnpool2d. Default: False
    Examples >>> # target output size of 5x7
>>> m = nn.AdaptiveMaxPool2d((5,7))
>>> input = torch.randn(1, 64, 8, 9)
>>> output = m(input)
>>> # target output size of 7x7 (square)
>>> m = nn.AdaptiveMaxPool2d(7)
>>> input = torch.randn(1, 64, 10, 9)
>>> output = m(input)
>>> # target output size of 10x7
>>> m = nn.AdaptiveMaxPool2d((None, 7))
>>> input = torch.randn(1, 64, 10, 9)
>>> output = m(input)
class torch.nn.AdaptiveMaxPool3d(output_size, return_indices=False) [source]
 
Applies a 3D adaptive max pooling over an input signal composed of several input planes. The output is of size D x H x W, for any input size. The number of output features is equal to the number of input planes.  Parameters 
 
output_size – the target output size of the image of the form D x H x W. Can be a tuple (D, H, W) or a single D for a cube D x D x D. D, H and W can be either a int, or None which means the size will be the same as that of the input. 
return_indices – if True, will return the indices along with the outputs. Useful to pass to nn.MaxUnpool3d. Default: False
    Examples >>> # target output size of 5x7x9
>>> m = nn.AdaptiveMaxPool3d((5,7,9))
>>> input = torch.randn(1, 64, 8, 9, 10)
>>> output = m(input)
>>> # target output size of 7x7x7 (cube)
>>> m = nn.AdaptiveMaxPool3d(7)
>>> input = torch.randn(1, 64, 10, 9, 8)
>>> output = m(input)
>>> # target output size of 7x9x8
>>> m = nn.AdaptiveMaxPool3d((7, None, None))
>>> input = torch.randn(1, 64, 10, 9, 8)
>>> output = m(input)
class torch.nn.AlphaDropout(p=0.5, inplace=False) [source]
 
Applies Alpha Dropout over the input. Alpha Dropout is a type of Dropout that maintains the self-normalizing property. For an input with zero mean and unit standard deviation, the output of Alpha Dropout maintains the original mean and standard deviation of the input. Alpha Dropout goes hand-in-hand with SELU activation function, which ensures that the outputs have zero mean and unit standard deviation. During training, it randomly masks some of the elements of the input tensor with probability p using samples from a bernoulli distribution. The elements to masked are randomized on every forward call, and scaled and shifted to maintain zero mean and unit standard deviation. During evaluation the module simply computes an identity function. More details can be found in the paper Self-Normalizing Neural Networks .  Parameters 
 
p (float) – probability of an element to be dropped. Default: 0.5 
inplace (bool, optional) – If set to True, will do this operation in-place     Shape:

 Input: (∗)(*) . Input can be of any shape Output: (∗)(*) . Output is of the same shape as input    Examples: >>> m = nn.AlphaDropout(p=0.2)
>>> input = torch.randn(20, 16)
>>> output = m(input)
class torch.nn.AvgPool1d(kernel_size, stride=None, padding=0, ceil_mode=False, count_include_pad=True) [source]
 
Applies a 1D average pooling over an input signal composed of several input planes. In the simplest case, the output value of the layer with input size (N,C,L)(N, C, L) , output (N,C,Lout)(N, C, L_{out})  and kernel_size kk  can be precisely described as:  out(Ni,Cj,l)=1k∑m=0k−1input(Ni,Cj,stride×l+m)\text{out}(N_i, C_j, l) = \frac{1}{k} \sum_{m=0}^{k-1} \text{input}(N_i, C_j, \text{stride} \times l + m) 
If padding is non-zero, then the input is implicitly zero-padded on both sides for padding number of points.  Note When ceil_mode=True, sliding windows are allowed to go off-bounds if they start within the left padding or the input. Sliding windows that would start in the right padded region are ignored.  The parameters kernel_size, stride, padding can each be an int or a one-element tuple.  Parameters 
 
kernel_size – the size of the window 
stride – the stride of the window. Default value is kernel_size
 
padding – implicit zero padding to be added on both sides 
ceil_mode – when True, will use ceil instead of floor to compute the output shape 
count_include_pad – when True, will include the zero-padding in the averaging calculation     Shape:

 Input: (N,C,Lin)(N, C, L_{in}) 
 
Output: (N,C,Lout)(N, C, L_{out}) , where  Lout=⌊Lin+2×padding−kernel_sizestride+1⌋L_{out} = \left\lfloor \frac{L_{in} + 2 \times \text{padding} - \text{kernel\_size}}{\text{stride}} + 1\right\rfloor  
    Examples: >>> # pool with window of size=3, stride=2
>>> m = nn.AvgPool1d(3, stride=2)
>>> m(torch.tensor([[[1.,2,3,4,5,6,7]]]))
tensor([[[ 2.,  4.,  6.]]])
class torch.nn.AvgPool2d(kernel_size, stride=None, padding=0, ceil_mode=False, count_include_pad=True, divisor_override=None) [source]
 
Applies a 2D average pooling over an input signal composed of several input planes. In the simplest case, the output value of the layer with input size (N,C,H,W)(N, C, H, W) , output (N,C,Hout,Wout)(N, C, H_{out}, W_{out})  and kernel_size (kH,kW)(kH, kW)  can be precisely described as:  out(Ni,Cj,h,w)=1kH∗kW∑m=0kH−1∑n=0kW−1input(Ni,Cj,stride[0]×h+m,stride[1]×w+n)out(N_i, C_j, h, w) = \frac{1}{kH * kW} \sum_{m=0}^{kH-1} \sum_{n=0}^{kW-1} input(N_i, C_j, stride[0] \times h + m, stride[1] \times w + n) 
If padding is non-zero, then the input is implicitly zero-padded on both sides for padding number of points.  Note When ceil_mode=True, sliding windows are allowed to go off-bounds if they start within the left padding or the input. Sliding windows that would start in the right padded region are ignored.  The parameters kernel_size, stride, padding can either be:  a single int – in which case the same value is used for the height and width dimension a tuple of two ints – in which case, the first int is used for the height dimension, and the second int for the width dimension   Parameters 
 
kernel_size – the size of the window 
stride – the stride of the window. Default value is kernel_size
 
padding – implicit zero padding to be added on both sides 
ceil_mode – when True, will use ceil instead of floor to compute the output shape 
count_include_pad – when True, will include the zero-padding in the averaging calculation 
divisor_override – if specified, it will be used as divisor, otherwise kernel_size will be used     Shape:

 Input: (N,C,Hin,Win)(N, C, H_{in}, W_{in}) 
 
Output: (N,C,Hout,Wout)(N, C, H_{out}, W_{out}) , where  Hout=⌊Hin+2×padding[0]−kernel_size[0]stride[0]+1⌋H_{out} = \left\lfloor\frac{H_{in} + 2 \times \text{padding}[0] - \text{kernel\_size}[0]}{\text{stride}[0]} + 1\right\rfloor  
 Wout=⌊Win+2×padding[1]−kernel_size[1]stride[1]+1⌋W_{out} = \left\lfloor\frac{W_{in} + 2 \times \text{padding}[1] - \text{kernel\_size}[1]}{\text{stride}[1]} + 1\right\rfloor  
    Examples: >>> # pool of square window of size=3, stride=2
>>> m = nn.AvgPool2d(3, stride=2)
>>> # pool of non-square window
>>> m = nn.AvgPool2d((3, 2), stride=(2, 1))
>>> input = torch.randn(20, 16, 50, 32)
>>> output = m(input)
class torch.nn.AvgPool3d(kernel_size, stride=None, padding=0, ceil_mode=False, count_include_pad=True, divisor_override=None) [source]
 
Applies a 3D average pooling over an input signal composed of several input planes. In the simplest case, the output value of the layer with input size (N,C,D,H,W)(N, C, D, H, W) , output (N,C,Dout,Hout,Wout)(N, C, D_{out}, H_{out}, W_{out})  and kernel_size (kD,kH,kW)(kD, kH, kW)  can be precisely described as:  out(Ni,Cj,d,h,w)=∑k=0kD−1∑m=0kH−1∑n=0kW−1input(Ni,Cj,stride[0]×d+k,stride[1]×h+m,stride[2]×w+n)kD×kH×kW\begin{aligned} \text{out}(N_i, C_j, d, h, w) ={} & \sum_{k=0}^{kD-1} \sum_{m=0}^{kH-1} \sum_{n=0}^{kW-1} \\ & \frac{\text{input}(N_i, C_j, \text{stride}[0] \times d + k, \text{stride}[1] \times h + m, \text{stride}[2] \times w + n)} {kD \times kH \times kW} \end{aligned}  
If padding is non-zero, then the input is implicitly zero-padded on all three sides for padding number of points.  Note When ceil_mode=True, sliding windows are allowed to go off-bounds if they start within the left padding or the input. Sliding windows that would start in the right padded region are ignored.  The parameters kernel_size, stride can either be:  a single int – in which case the same value is used for the depth, height and width dimension a tuple of three ints – in which case, the first int is used for the depth dimension, the second int for the height dimension and the third int for the width dimension   Parameters 
 
kernel_size – the size of the window 
stride – the stride of the window. Default value is kernel_size
 
padding – implicit zero padding to be added on all three sides 
ceil_mode – when True, will use ceil instead of floor to compute the output shape 
count_include_pad – when True, will include the zero-padding in the averaging calculation 
divisor_override – if specified, it will be used as divisor, otherwise kernel_size will be used     Shape:

 Input: (N,C,Din,Hin,Win)(N, C, D_{in}, H_{in}, W_{in}) 
 
Output: (N,C,Dout,Hout,Wout)(N, C, D_{out}, H_{out}, W_{out}) , where  Dout=⌊Din+2×padding[0]−kernel_size[0]stride[0]+1⌋D_{out} = \left\lfloor\frac{D_{in} + 2 \times \text{padding}[0] - \text{kernel\_size}[0]}{\text{stride}[0]} + 1\right\rfloor  
 Hout=⌊Hin+2×padding[1]−kernel_size[1]stride[1]+1⌋H_{out} = \left\lfloor\frac{H_{in} + 2 \times \text{padding}[1] - \text{kernel\_size}[1]}{\text{stride}[1]} + 1\right\rfloor  
 Wout=⌊Win+2×padding[2]−kernel_size[2]stride[2]+1⌋W_{out} = \left\lfloor\frac{W_{in} + 2 \times \text{padding}[2] - \text{kernel\_size}[2]}{\text{stride}[2]} + 1\right\rfloor  
    Examples: >>> # pool of square window of size=3, stride=2
>>> m = nn.AvgPool3d(3, stride=2)
>>> # pool of non-square window
>>> m = nn.AvgPool3d((3, 2, 2), stride=(2, 1, 2))
>>> input = torch.randn(20, 16, 50,44, 31)
>>> output = m(input)
class torch.nn.BatchNorm1d(num_features, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) [source]
 
Applies Batch Normalization over a 2D or 3D input (a mini-batch of 1D inputs with optional additional channel dimension) as described in the paper Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift .  y=x−E[x]Var[x]+ϵ∗γ+βy = \frac{x - \mathrm{E}[x]}{\sqrt{\mathrm{Var}[x] + \epsilon}} * \gamma + \beta 
The mean and standard-deviation are calculated per-dimension over the mini-batches and γ\gamma  and β\beta  are learnable parameter vectors of size C (where C is the input size). By default, the elements of γ\gamma  are set to 1 and the elements of β\beta  are set to 0. The standard-deviation is calculated via the biased estimator, equivalent to torch.var(input, unbiased=False). Also by default, during training this layer keeps running estimates of its computed mean and variance, which are then used for normalization during evaluation. The running estimates are kept with a default momentum of 0.1. If track_running_stats is set to False, this layer then does not keep running estimates, and batch statistics are instead used during evaluation time as well.  Note This momentum argument is different from one used in optimizer classes and the conventional notion of momentum. Mathematically, the update rule for running statistics here is x^new=(1−momentum)×x^+momentum×xt\hat{x}_\text{new} = (1 - \text{momentum}) \times \hat{x} + \text{momentum} \times x_t , where x^\hat{x}  is the estimated statistic and xtx_t  is the new observed value.  Because the Batch Normalization is done over the C dimension, computing statistics on (N, L) slices, it’s common terminology to call this Temporal Batch Normalization.  Parameters 
 
num_features – CC  from an expected input of size (N,C,L)(N, C, L)  or LL  from input of size (N,L)(N, L) 
 
eps – a value added to the denominator for numerical stability. Default: 1e-5 
momentum – the value used for the running_mean and running_var computation. Can be set to None for cumulative moving average (i.e. simple average). Default: 0.1 
affine – a boolean value that when set to True, this module has learnable affine parameters. Default: True
 
track_running_stats – a boolean value that when set to True, this module tracks the running mean and variance, and when set to False, this module does not track such statistics, and initializes statistics buffers running_mean and running_var as None. When these buffers are None, this module always uses batch statistics. in both training and eval modes. Default: True
     Shape:

 Input: (N,C)(N, C)  or (N,C,L)(N, C, L) 
 Output: (N,C)(N, C)  or (N,C,L)(N, C, L)  (same shape as input)    Examples: >>> # With Learnable Parameters
>>> m = nn.BatchNorm1d(100)
>>> # Without Learnable Parameters
>>> m = nn.BatchNorm1d(100, affine=False)
>>> input = torch.randn(20, 100)
>>> output = m(input)
class torch.nn.BatchNorm2d(num_features, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) [source]
 
Applies Batch Normalization over a 4D input (a mini-batch of 2D inputs with additional channel dimension) as described in the paper Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift .  y=x−E[x]Var[x]+ϵ∗γ+βy = \frac{x - \mathrm{E}[x]}{ \sqrt{\mathrm{Var}[x] + \epsilon}} * \gamma + \beta 
The mean and standard-deviation are calculated per-dimension over the mini-batches and γ\gamma  and β\beta  are learnable parameter vectors of size C (where C is the input size). By default, the elements of γ\gamma  are set to 1 and the elements of β\beta  are set to 0. The standard-deviation is calculated via the biased estimator, equivalent to torch.var(input, unbiased=False). Also by default, during training this layer keeps running estimates of its computed mean and variance, which are then used for normalization during evaluation. The running estimates are kept with a default momentum of 0.1. If track_running_stats is set to False, this layer then does not keep running estimates, and batch statistics are instead used during evaluation time as well.  Note This momentum argument is different from one used in optimizer classes and the conventional notion of momentum. Mathematically, the update rule for running statistics here is x^new=(1−momentum)×x^+momentum×xt\hat{x}_\text{new} = (1 - \text{momentum}) \times \hat{x} + \text{momentum} \times x_t , where x^\hat{x}  is the estimated statistic and xtx_t  is the new observed value.  Because the Batch Normalization is done over the C dimension, computing statistics on (N, H, W) slices, it’s common terminology to call this Spatial Batch Normalization.  Parameters 
 
num_features – CC  from an expected input of size (N,C,H,W)(N, C, H, W) 
 
eps – a value added to the denominator for numerical stability. Default: 1e-5 
momentum – the value used for the running_mean and running_var computation. Can be set to None for cumulative moving average (i.e. simple average). Default: 0.1 
affine – a boolean value that when set to True, this module has learnable affine parameters. Default: True
 
track_running_stats – a boolean value that when set to True, this module tracks the running mean and variance, and when set to False, this module does not track such statistics, and initializes statistics buffers running_mean and running_var as None. When these buffers are None, this module always uses batch statistics. in both training and eval modes. Default: True
     Shape:

 Input: (N,C,H,W)(N, C, H, W) 
 Output: (N,C,H,W)(N, C, H, W)  (same shape as input)    Examples: >>> # With Learnable Parameters
>>> m = nn.BatchNorm2d(100)
>>> # Without Learnable Parameters
>>> m = nn.BatchNorm2d(100, affine=False)
>>> input = torch.randn(20, 100, 35, 45)
>>> output = m(input)