neulab/docprompting-conala huggingface dataset:
add_histogram(tag, values, global_step=None, bins='tensorflow', walltime=None, max_bins=None) [source]
 
Add histogram to summary.  Parameters 
 
tag (string) – Data identifier 
values (torch.Tensor, numpy.array, or string/blobname) – Values to build histogram 
global_step (int) – Global step value to record 
bins (string) – One of {‘tensorflow’,’auto’, ‘fd’, …}. This determines how the bins are made. You can find other options in: https://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram.html
 
walltime (float) – Optional override default walltime (time.time()) seconds after epoch of event    Examples: from torch.utils.tensorboard import SummaryWriter
import numpy as np
writer = SummaryWriter()
for i in range(10):
    x = np.random.random(1000)
    writer.add_histogram('distribution centers', x + i, i)
writer.close()
 Expected result:
add_hparams(hparam_dict, metric_dict, hparam_domain_discrete=None, run_name=None) [source]
 
Add a set of hyperparameters to be compared in TensorBoard.  Parameters 
 
hparam_dict (dict) – Each key-value pair in the dictionary is the name of the hyper parameter and it’s corresponding value. The type of the value can be one of bool, string, float, int, or None. 
metric_dict (dict) – Each key-value pair in the dictionary is the name of the metric and it’s corresponding value. Note that the key used here should be unique in the tensorboard record. Otherwise the value you added by add_scalar will be displayed in hparam plugin. In most cases, this is unwanted. 
hparam_domain_discrete – (Optional[Dict[str, List[Any]]]) A dictionary that contains names of the hyperparameters and all discrete values they can hold 
run_name (str) – Name of the run, to be included as part of the logdir. If unspecified, will use current timestamp.    Examples: from torch.utils.tensorboard import SummaryWriter
with SummaryWriter() as w:
    for i in range(5):
        w.add_hparams({'lr': 0.1*i, 'bsize': i},
                      {'hparam/accuracy': 10*i, 'hparam/loss': 10*i})
 Expected result:
add_image(tag, img_tensor, global_step=None, walltime=None, dataformats='CHW') [source]
 
Add image data to summary. Note that this requires the pillow package.  Parameters 
 
tag (string) – Data identifier 
img_tensor (torch.Tensor, numpy.array, or string/blobname) – Image data 
global_step (int) – Global step value to record 
walltime (float) – Optional override default walltime (time.time()) seconds after epoch of event     Shape:

img_tensor: Default is (3,H,W)(3, H, W) . You can use torchvision.utils.make_grid() to convert a batch of tensor into 3xHxW format or call add_images and let us do the job. Tensor with (1,H,W)(1, H, W) , (H,W)(H, W) , (H,W,3)(H, W, 3)  is also suitable as long as corresponding dataformats argument is passed, e.g. CHW, HWC, HW.   Examples: from torch.utils.tensorboard import SummaryWriter
import numpy as np
img = np.zeros((3, 100, 100))
img[0] = np.arange(0, 10000).reshape(100, 100) / 10000
img[1] = 1 - np.arange(0, 10000).reshape(100, 100) / 10000

img_HWC = np.zeros((100, 100, 3))
img_HWC[:, :, 0] = np.arange(0, 10000).reshape(100, 100) / 10000
img_HWC[:, :, 1] = 1 - np.arange(0, 10000).reshape(100, 100) / 10000

writer = SummaryWriter()
writer.add_image('my_image', img, 0)

# If you have non-default dimension setting, set the dataformats argument.
writer.add_image('my_image_HWC', img_HWC, 0, dataformats='HWC')
writer.close()
 Expected result:
add_images(tag, img_tensor, global_step=None, walltime=None, dataformats='NCHW') [source]
 
Add batched image data to summary. Note that this requires the pillow package.  Parameters 
 
tag (string) – Data identifier 
img_tensor (torch.Tensor, numpy.array, or string/blobname) – Image data 
global_step (int) – Global step value to record 
walltime (float) – Optional override default walltime (time.time()) seconds after epoch of event 
dataformats (string) – Image data format specification of the form NCHW, NHWC, CHW, HWC, HW, WH, etc.     Shape:

img_tensor: Default is (N,3,H,W)(N, 3, H, W) . If dataformats is specified, other shape will be accepted. e.g. NCHW or NHWC.   Examples: from torch.utils.tensorboard import SummaryWriter
import numpy as np

img_batch = np.zeros((16, 3, 100, 100))
for i in range(16):
    img_batch[i, 0] = np.arange(0, 10000).reshape(100, 100) / 10000 / 16 * i
    img_batch[i, 1] = (1 - np.arange(0, 10000).reshape(100, 100) / 10000) / 16 * i

writer = SummaryWriter()
writer.add_images('my_image_batch', img_batch, 0)
writer.close()
 Expected result:
add_mesh(tag, vertices, colors=None, faces=None, config_dict=None, global_step=None, walltime=None) [source]
 
Add meshes or 3D point clouds to TensorBoard. The visualization is based on Three.js, so it allows users to interact with the rendered object. Besides the basic definitions such as vertices, faces, users can further provide camera parameter, lighting condition, etc. Please check https://threejs.org/docs/index.html#manual/en/introduction/Creating-a-scene for advanced usage.  Parameters 
 
tag (string) – Data identifier 
vertices (torch.Tensor) – List of the 3D coordinates of vertices. 
colors (torch.Tensor) – Colors for each vertex 
faces (torch.Tensor) – Indices of vertices within each triangle. (Optional) 
config_dict – Dictionary with ThreeJS classes names and configuration. 
global_step (int) – Global step value to record 
walltime (float) – Optional override default walltime (time.time()) seconds after epoch of event     Shape:

vertices: (B,N,3)(B, N, 3) . (batch, number_of_vertices, channels) colors: (B,N,3)(B, N, 3) . The values should lie in [0, 255] for type uint8 or [0, 1] for type float. faces: (B,N,3)(B, N, 3) . The values should lie in [0, number_of_vertices] for type uint8.   Examples: from torch.utils.tensorboard import SummaryWriter
vertices_tensor = torch.as_tensor([
    [1, 1, 1],
    [-1, -1, 1],
    [1, -1, -1],
    [-1, 1, -1],
], dtype=torch.float).unsqueeze(0)
colors_tensor = torch.as_tensor([
    [255, 0, 0],
    [0, 255, 0],
    [0, 0, 255],
    [255, 0, 255],
], dtype=torch.int).unsqueeze(0)
faces_tensor = torch.as_tensor([
    [0, 2, 3],
    [0, 3, 1],
    [0, 1, 2],
    [1, 3, 2],
], dtype=torch.int).unsqueeze(0)

writer = SummaryWriter()
writer.add_mesh('my_mesh', vertices=vertices_tensor, colors=colors_tensor, faces=faces_tensor)

writer.close()
add_pr_curve(tag, labels, predictions, global_step=None, num_thresholds=127, weights=None, walltime=None) [source]
 
Adds precision recall curve. Plotting a precision-recall curve lets you understand your model’s performance under different threshold settings. With this function, you provide the ground truth labeling (T/F) and prediction confidence (usually the output of your model) for each target. The TensorBoard UI will let you choose the threshold interactively.  Parameters 
 
tag (string) – Data identifier 
labels (torch.Tensor, numpy.array, or string/blobname) – Ground truth data. Binary label for each element. 
predictions (torch.Tensor, numpy.array, or string/blobname) – The probability that an element be classified as true. Value should be in [0, 1] 
global_step (int) – Global step value to record 
num_thresholds (int) – Number of thresholds used to draw the curve. 
walltime (float) – Optional override default walltime (time.time()) seconds after epoch of event    Examples: from torch.utils.tensorboard import SummaryWriter
import numpy as np
labels = np.random.randint(2, size=100)  # binary label
predictions = np.random.rand(100)
writer = SummaryWriter()
writer.add_pr_curve('pr_curve', labels, predictions, 0)
writer.close()
add_scalar(tag, scalar_value, global_step=None, walltime=None) [source]
 
Add scalar data to summary.  Parameters 
 
tag (string) – Data identifier 
scalar_value (float or string/blobname) – Value to save 
global_step (int) – Global step value to record 
walltime (float) – Optional override default walltime (time.time()) with seconds after epoch of event    Examples: from torch.utils.tensorboard import SummaryWriter
writer = SummaryWriter()
x = range(100)
for i in x:
    writer.add_scalar('y=2x', i * 2, i)
writer.close()
 Expected result:
add_scalars(main_tag, tag_scalar_dict, global_step=None, walltime=None) [source]
 
Adds many scalar data to summary.  Parameters 
 
main_tag (string) – The parent name for the tags 
tag_scalar_dict (dict) – Key-value pair storing the tag and corresponding values 
global_step (int) – Global step value to record 
walltime (float) – Optional override default walltime (time.time()) seconds after epoch of event    Examples: from torch.utils.tensorboard import SummaryWriter
writer = SummaryWriter()
r = 5
for i in range(100):
    writer.add_scalars('run_14h', {'xsinx':i*np.sin(i/r),
                                    'xcosx':i*np.cos(i/r),
                                    'tanx': np.tan(i/r)}, i)
writer.close()
# This call adds three values to the same scalar plot with the tag
# 'run_14h' in TensorBoard's scalar section.
 Expected result:
add_text(tag, text_string, global_step=None, walltime=None) [source]
 
Add text data to summary.  Parameters 
 
tag (string) – Data identifier 
text_string (string) – String to save 
global_step (int) – Global step value to record 
walltime (float) – Optional override default walltime (time.time()) seconds after epoch of event    Examples: writer.add_text('lstm', 'This is an lstm', 0)
writer.add_text('rnn', 'This is an rnn', 10)
add_video(tag, vid_tensor, global_step=None, fps=4, walltime=None) [source]
 
Add video data to summary. Note that this requires the moviepy package.  Parameters 
 
tag (string) – Data identifier 
vid_tensor (torch.Tensor) – Video data 
global_step (int) – Global step value to record 
fps (float or int) – Frames per second 
walltime (float) – Optional override default walltime (time.time()) seconds after epoch of event     Shape:

vid_tensor: (N,T,C,H,W)(N, T, C, H, W) . The values should lie in [0, 255] for type uint8 or [0, 1] for type float.
flush() [source]
 
Flushes the event file to disk. Call this method to make sure that all pending events have been written to disk.
__init__(log_dir=None, comment='', purge_step=None, max_queue=10, flush_secs=120, filename_suffix='') [source]
 
Creates a SummaryWriter that will write out events and summaries to the event file.  Parameters 
 
log_dir (string) – Save directory location. Default is runs/CURRENT_DATETIME_HOSTNAME, which changes after each run. Use hierarchical folder structure to compare between runs easily. e.g. pass in ‘runs/exp1’, ‘runs/exp2’, etc. for each new experiment to compare across them. 
comment (string) – Comment log_dir suffix appended to the default log_dir. If log_dir is assigned, this argument has no effect. 
purge_step (int) – When logging crashes at step T+XT+X  and restarts at step TT , any events whose global_step larger or equal to TT  will be purged and hidden from TensorBoard. Note that crashed and resumed experiments should have the same log_dir. 
max_queue (int) – Size of the queue for pending events and summaries before one of the ‘add’ calls forces a flush to disk. Default is ten items. 
flush_secs (int) – How often, in seconds, to flush the pending events and summaries to disk. Default is every two minutes. 
filename_suffix (string) – Suffix added to all event filenames in the log_dir directory. More details on filename construction in tensorboard.summary.writer.event_file_writer.EventFileWriter.    Examples: from torch.utils.tensorboard import SummaryWriter

# create a summary writer with automatically generated folder name.
writer = SummaryWriter()
# folder location: runs/May04_22-14-54_s-MacBook-Pro.local/

# create a summary writer using the specified folder name.
writer = SummaryWriter("my_experiment")
# folder location: my_experiment

# create a summary writer with comment appended.
writer = SummaryWriter(comment="LR_0.1_BATCH_16")
# folder location: runs/May04_22-14-54_s-MacBook-Pro.localLR_0.1_BATCH_16/
torch.vander(x, N=None, increasing=False) → Tensor  
Generates a Vandermonde matrix. The columns of the output matrix are elementwise powers of the input vector x(N−1),x(N−2),...,x0x^{(N-1)}, x^{(N-2)}, ..., x^0 . If increasing is True, the order of the columns is reversed x0,x1,...,x(N−1)x^0, x^1, ..., x^{(N-1)} . Such a matrix with a geometric progression in each row is named for Alexandre-Theophile Vandermonde.  Parameters 
 
x (Tensor) – 1-D input tensor. 
N (int, optional) – Number of columns in the output. If N is not specified, a square array is returned (N=len(x))(N = len(x)) . 
increasing (bool, optional) – Order of the powers of the columns. If True, the powers increase from left to right, if False (the default) they are reversed.   Returns 
Vandermonde matrix. If increasing is False, the first column is x(N−1)x^{(N-1)} , the second x(N−2)x^{(N-2)}  and so forth. If increasing is True, the columns are x0,x1,...,x(N−1)x^0, x^1, ..., x^{(N-1)} .  Return type 
Tensor   Example: >>> x = torch.tensor([1, 2, 3, 5])
>>> torch.vander(x)
tensor([[  1,   1,   1,   1],
        [  8,   4,   2,   1],
        [ 27,   9,   3,   1],
        [125,  25,   5,   1]])
>>> torch.vander(x, N=3)
tensor([[ 1,  1,  1],
        [ 4,  2,  1],
        [ 9,  3,  1],
        [25,  5,  1]])
>>> torch.vander(x, N=3, increasing=True)
tensor([[ 1,  1,  1],
        [ 1,  2,  4],
        [ 1,  3,  9],
        [ 1,  5, 25]])
torch.var(input, unbiased=True) → Tensor  
Returns the variance of all elements in the input tensor. If unbiased is False, then the variance will be calculated via the biased estimator. Otherwise, Bessel’s correction will be used.  Parameters 
 
input (Tensor) – the input tensor. 
unbiased (bool) – whether to use the unbiased estimation or not    Example: >>> a = torch.randn(1, 3)
>>> a
tensor([[-0.3425, -1.2636, -0.4864]])
>>> torch.var(a)
tensor(0.2455)
  
torch.var(input, dim, unbiased=True, keepdim=False, *, out=None) → Tensor 
 Returns the variance of each row of the input tensor in the given dimension dim. If keepdim is True, the output tensor is of the same size as input except in the dimension(s) dim where it is of size 1. Otherwise, dim is squeezed (see torch.squeeze()), resulting in the output tensor having 1 (or len(dim)) fewer dimension(s). If unbiased is False, then the variance will be calculated via the biased estimator. Otherwise, Bessel’s correction will be used.  Parameters 
 
input (Tensor) – the input tensor. 
dim (int or tuple of python:ints) – the dimension or dimensions to reduce. 
unbiased (bool) – whether to use the unbiased estimation or not 
keepdim (bool) – whether the output tensor has dim retained or not.   Keyword Arguments 
out (Tensor, optional) – the output tensor.   Example: >>> a = torch.randn(4, 4)
>>> a
tensor([[-0.3567,  1.7385, -1.3042,  0.7423],
        [ 1.3436, -0.1015, -0.9834, -0.8438],
        [ 0.6056,  0.1089, -0.3112, -1.4085],
        [-0.7700,  0.6074, -0.1469,  0.7777]])
>>> torch.var(a, 1)
tensor([ 1.7444,  1.1363,  0.7356,  0.5112])
torch.var_mean(input, unbiased=True) -> (Tensor, Tensor)  
Returns the variance and mean of all elements in the input tensor. If unbiased is False, then the variance will be calculated via the biased estimator. Otherwise, Bessel’s correction will be used.  Parameters 
 
input (Tensor) – the input tensor. 
unbiased (bool) – whether to use the unbiased estimation or not    Example: >>> a = torch.randn(1, 3)
>>> a
tensor([[0.0146, 0.4258, 0.2211]])
>>> torch.var_mean(a)
(tensor(0.0423), tensor(0.2205))
  
torch.var_mean(input, dim, keepdim=False, unbiased=True) -> (Tensor, Tensor) 
 Returns the variance and mean of each row of the input tensor in the given dimension dim. If keepdim is True, the output tensor is of the same size as input except in the dimension(s) dim where it is of size 1. Otherwise, dim is squeezed (see torch.squeeze()), resulting in the output tensor having 1 (or len(dim)) fewer dimension(s). If unbiased is False, then the variance will be calculated via the biased estimator. Otherwise, Bessel’s correction will be used.  Parameters 
 
input (Tensor) – the input tensor. 
dim (int or tuple of python:ints) – the dimension or dimensions to reduce. 
keepdim (bool) – whether the output tensor has dim retained or not. 
unbiased (bool) – whether to use the unbiased estimation or not    Example: >>> a = torch.randn(4, 4)
>>> a
tensor([[-1.5650,  2.0415, -0.1024, -0.5790],
        [ 0.2325, -2.6145, -1.6428, -0.3537],
        [-0.2159, -1.1069,  1.2882, -1.3265],
        [-0.6706, -1.5893,  0.6827,  1.6727]])
>>> torch.var_mean(a, 1)
(tensor([2.3174, 1.6403, 1.4092, 2.0791]), tensor([-0.0512, -1.0946, -0.3403,  0.0239]))
torch.vdot(input, other, *, out=None) → Tensor  
Computes the dot product of two 1D tensors. The vdot(a, b) function handles complex numbers differently than dot(a, b). If the first argument is complex, the complex conjugate of the first argument is used for the calculation of the dot product.  Note Unlike NumPy’s vdot, torch.vdot intentionally only supports computing the dot product of two 1D tensors with the same number of elements.   Parameters 
 
input (Tensor) – first tensor in the dot product, must be 1D. Its conjugate is used if it’s complex. 
other (Tensor) – second tensor in the dot product, must be 1D.   Keyword Arguments 
out (Tensor, optional) – the output tensor.   Example: >>> torch.vdot(torch.tensor([2, 3]), torch.tensor([2, 1]))
tensor(7)
>>> a = torch.tensor((1 +2j, 3 - 1j))
>>> b = torch.tensor((2 +1j, 4 - 0j))
>>> torch.vdot(a, b)
tensor([16.+1.j])
>>> torch.vdot(b, a)
tensor([16.-1.j])
torch.view_as_complex(input) → Tensor  
Returns a view of input as a complex tensor. For an input complex tensor of size m1,m2,…,mi,2m1, m2, \dots, mi, 2 , this function returns a new complex tensor of size m1,m2,…,mim1, m2, \dots, mi  where the last dimension of the input tensor is expected to represent the real and imaginary components of complex numbers.  Warning view_as_complex() is only supported for tensors with torch.dtype torch.float64 and torch.float32. The input is expected to have the last dimension of size 2. In addition, the tensor must have a stride of 1 for its last dimension. The strides of all other dimensions must be even numbers.   Parameters 
input (Tensor) – the input tensor.    Example::

>>> x=torch.randn(4, 2)
>>> x
tensor([[ 1.6116, -0.5772],
        [-1.4606, -0.9120],
        [ 0.0786, -1.7497],
        [-0.6561, -1.6623]])
>>> torch.view_as_complex(x)
tensor([(1.6116-0.5772j), (-1.4606-0.9120j), (0.0786-1.7497j), (-0.6561-1.6623j)])
torch.view_as_real(input) → Tensor  
Returns a view of input as a real tensor. For an input complex tensor of size m1,m2,…,mim1, m2, \dots, mi , this function returns a new real tensor of size m1,m2,…,mi,2m1, m2, \dots, mi, 2 , where the last dimension of size 2 represents the real and imaginary components of complex numbers.  Warning view_as_real() is only supported for tensors with complex dtypes.   Parameters 
input (Tensor) – the input tensor.    Example::

>>> x=torch.randn(4, dtype=torch.cfloat)
>>> x
tensor([(0.4737-0.3839j), (-0.2098-0.6699j), (0.3470-0.9451j), (-0.5174-1.3136j)])
>>> torch.view_as_real(x)
tensor([[ 0.4737, -0.3839],
        [-0.2098, -0.6699],
        [ 0.3470, -0.9451],
        [-0.5174, -1.3136]])
torch.vstack(tensors, *, out=None) → Tensor  
Stack tensors in sequence vertically (row wise). This is equivalent to concatenation along the first axis after all 1-D tensors have been reshaped by torch.atleast_2d().  Parameters 
tensors (sequence of Tensors) – sequence of tensors to concatenate  Keyword Arguments 
out (Tensor, optional) – the output tensor.   Example: >>> a = torch.tensor([1, 2, 3])
>>> b = torch.tensor([4, 5, 6])
>>> torch.vstack((a,b))
tensor([[1, 2, 3],
        [4, 5, 6]])
>>> a = torch.tensor([[1],[2],[3]])
>>> b = torch.tensor([[4],[5],[6]])
>>> torch.vstack((a,b))
tensor([[1],
        [2],
        [3],
        [4],
        [5],
        [6]])
torch.where(condition, x, y) → Tensor  
Return a tensor of elements selected from either x or y, depending on condition. The operation is defined as:  outi={xiif conditioniyiotherwise\text{out}_i = \begin{cases} \text{x}_i & \text{if } \text{condition}_i \\ \text{y}_i & \text{otherwise} \\ \end{cases}  
 Note The tensors condition, x, y must be broadcastable.   Note Currently valid scalar and tensor combination are 1. Scalar of floating dtype and torch.double 2. Scalar of integral dtype and torch.long 3. Scalar of complex dtype and torch.complex128   Parameters 
 
condition (BoolTensor) – When True (nonzero), yield x, otherwise yield y 
x (Tensor or Scalar) – value (if :attr:x is a scalar) or values selected at indices where condition is True
 
y (Tensor or Scalar) – value (if :attr:x is a scalar) or values selected at indices where condition is False
   Returns 
A tensor of shape equal to the broadcasted shape of condition, x, y  Return type 
Tensor   Example: >>> x = torch.randn(3, 2)
>>> y = torch.ones(3, 2)
>>> x
tensor([[-0.4620,  0.3139],
        [ 0.3898, -0.7197],
        [ 0.0478, -0.1657]])
>>> torch.where(x > 0, x, y)
tensor([[ 1.0000,  0.3139],
        [ 0.3898,  1.0000],
        [ 0.0478,  1.0000]])
>>> x = torch.randn(2, 2, dtype=torch.double)
>>> x
tensor([[ 1.0779,  0.0383],
        [-0.8785, -1.1089]], dtype=torch.float64)
>>> torch.where(x > 0, x, 0.)
tensor([[1.0779, 0.0383],
        [0.0000, 0.0000]], dtype=torch.float64)
  
torch.where(condition) → tuple of LongTensor 
 torch.where(condition) is identical to torch.nonzero(condition, as_tuple=True).  Note See also torch.nonzero().
torch.xlogy(input, other, *, out=None) → Tensor  
Computes input * log(other) with the following cases.  outi={NaNif otheri=NaN0if inputi=0.0inputi∗log⁡(otheri)otherwise\text{out}_{i} = \begin{cases} \text{NaN} & \text{if } \text{other}_{i} = \text{NaN} \\ 0 & \text{if } \text{input}_{i} = 0.0 \\ \text{input}_{i} * \log{(\text{other}_{i})} & \text{otherwise} \end{cases}  
Similar to SciPy’s scipy.special.xlogy.  Parameters 
 
input (Number or Tensor) –  
other (Number or Tensor) –      Note At least one of input or other must be a tensor.   Keyword Arguments 
out (Tensor, optional) – the output tensor.   Example: >>> x = torch.zeros(5,)
>>> y = torch.tensor([-1, 0, 1, float('inf'), float('nan')])
>>> torch.xlogy(x, y)
tensor([0., 0., 0., 0., nan])
>>> x = torch.tensor([1, 2, 3])
>>> y = torch.tensor([3, 2, 1])
>>> torch.xlogy(x, y)
tensor([1.0986, 1.3863, 0.0000])
>>> torch.xlogy(x, 4)
tensor([1.3863, 2.7726, 4.1589])
>>> torch.xlogy(2, y)
tensor([2.1972, 1.3863, 0.0000])
torch.zeros(*size, *, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False) → Tensor  
Returns a tensor filled with the scalar value 0, with the shape defined by the variable argument size.  Parameters 
size (int...) – a sequence of integers defining the shape of the output tensor. Can be a variable number of arguments or a collection like a list or tuple.  Keyword Arguments 
 
out (Tensor, optional) – the output tensor. 
dtype (torch.dtype, optional) – the desired data type of returned tensor. Default: if None, uses a global default (see torch.set_default_tensor_type()). 
layout (torch.layout, optional) – the desired layout of returned Tensor. Default: torch.strided. 
device (torch.device, optional) – the desired device of returned tensor. Default: if None, uses the current device for the default tensor type (see torch.set_default_tensor_type()). device will be the CPU for CPU tensor types and the current CUDA device for CUDA tensor types. 
requires_grad (bool, optional) – If autograd should record operations on the returned tensor. Default: False.    Example: >>> torch.zeros(2, 3)
tensor([[ 0.,  0.,  0.],
        [ 0.,  0.,  0.]])

>>> torch.zeros(5)
tensor([ 0.,  0.,  0.,  0.,  0.])