Tensor operations
Static member | Description |
|
The tensor will have the same element type as the input tensor.
|
|
|
|
|
Full Usage:
dsharp.arange (endVal, ?startVal, ?step, ?device, ?dtype, ?backend)
Parameters:
int
-
The ending value for the set of points.
?startVal : int
-
The starting value for the set of points. Default: 0.
?step : int
-
The gap between each pair of adjacent points. Default: 1.
?device : Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
Returns a 1-D tensor of size \(\left\lceil \frac{\text{end} - \text{start}}{\text{step}} \right\rceil\) with values from the interval [start, end) taken with common difference step beginning from start.
|
Full Usage:
dsharp.arange (endVal, ?startVal, ?step, ?device, ?dtype, ?backend)
Parameters:
float
-
The ending value for the set of points.
?startVal : float
-
The starting value for the set of points. Default: 0.
?step : float
-
The gap between each pair of adjacent points. Default: 1.
?device : Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
Returns a 1-D tensor of size \(\left\lceil \frac{\text{end} - \text{start}}{\text{step}} \right\rceil\) with values from the interval [start, end) taken with common difference step beginning from start. Non-integer steps may be subject to floating point rounding errors when comparing against end.
|
Full Usage:
dsharp.arangeLike (input, endVal, ?startVal, ?step, ?device, ?dtype, ?backend)
Parameters:
Tensor
-
The shape and characteristics of input will determine those of the output tensor.
endVal : int
-
The ending value for the set of points.
?startVal : int
-
The starting value for the set of points. Default: 0.
?step : int
-
The gap between each pair of adjacent points. Default: 1.
?device : Device
-
The desired device of returned tensor. Default: if None, the device of the input tensor is used.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, the element type of the input tensor is used.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, the backend of the input tensor is used.
Returns: Tensor
|
|
Full Usage:
dsharp.arangeLike (input, endVal, ?startVal, ?step, ?device, ?dtype, ?backend)
Parameters:
Tensor
-
The shape and characteristics of input will determine those of the output tensor.
endVal : float
-
The ending value for the set of points.
?startVal : float
-
The starting value for the set of points. Default: 0.
?step : float
-
The gap between each pair of adjacent points. Default: 1.
?device : Device
-
The desired device of returned tensor. Default: if None, the device of the input tensor is used.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, the element type of the input tensor is used.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, the backend of the input tensor is used.
Returns: Tensor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
dsharp.bceLoss (input, target, ?weight, ?reduction)
Parameters:
Tensor
-
The input tensor.
target : Tensor
-
The target tensor.
?weight : Tensor
-
A manual rescaling weight given to the loss of each batch element.
?reduction : string
-
Optionally specifies the reduction to apply to the output: 'none' | 'mean' | 'sum'. 'none': no reduction will be applied, 'mean': the sum of the output will be divided by the number of elements in the output, 'sum': the output will be summed. Note: size_average and reduce are in the process of being deprecated, and in the meantime, specifying either of those two args will override reduction. Default: 'mean'.
Returns: Tensor
|
|
Full Usage:
dsharp.bernoulli (probs, ?device, ?dtype, ?backend)
Parameters:
Tensor
-
The input tensor of probability values for the Bernoulli distribution.
?device : Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
|
|
If the element type is unchanged the input tensor will be returned.
|
|
Concatenates the given sequence of seq tensors in the given dimension. All tensors must either have the same shape (except in the concatenating dimension) or be empty.
|
|
Returns a new tensor with the ceil of the elements of input, the smallest integer greater than or equal to each element. The tensor will have the same element type as the input tensor.
|
|
|
|
|
|
|
|
|
Full Usage:
dsharp.config (?device, ?dtype, ?backend, ?printer)
Parameters:
Device
-
The new default device.
?dtype : Dtype
-
The new default element type. Only floating point dtypes are supported as the default.
?backend : Backend
-
The new default backend.
?printer : Printer
-
The new default printer.
|
|
Full Usage:
dsharp.conv1d (input, filters, ?stride, ?padding, ?dilation)
Parameters:
Tensor
-
The input tensor.
filters : Tensor
-
The filters.
?stride : int
-
The stride of the convolving kernel.
?padding : int
-
The implicit paddings on both sides of the input.
?dilation : int
-
The spacing between kernel elements.
Returns: Tensor
|
|
Full Usage:
dsharp.conv2d (input, filters, ?stride, ?strides, ?padding, ?paddings, ?dilation, ?dilations)
Parameters:
Tensor
-
The input tensor.
filters : Tensor
-
The filters.
?stride : int
-
The stride of the convolving kernel.
?strides : seq<int>
-
The strides of the convolving kernel.
?padding : int
-
The implicit padding on corresponding sides of the input.
?paddings : seq<int>
-
The implicit paddings on corresponding sides of the input.
?dilation : int
-
The spacing between kernel elements.
?dilations : seq<int>
-
The spacings between kernel elements.
Returns: Tensor
|
|
Full Usage:
dsharp.conv3d (input, filters, ?stride, ?strides, ?padding, ?paddings, ?dilation, ?dilations)
Parameters:
Tensor
-
The input tensor.
filters : Tensor
-
The filters.
?stride : int
-
The stride of the convolving kernel.
?strides : seq<int>
-
The strides of the convolving kernel.
?padding : int
-
The implicit padding on corresponding sides of the input.
?paddings : seq<int>
-
The implicit paddings on corresponding sides of the input.
?dilation : int
-
The spacing between kernel elements.
?dilations : seq<int>
-
The spacings between kernel elements.
Returns: Tensor
|
|
Full Usage:
dsharp.convTranspose1d (input, filters, ?stride, ?padding, ?dilation, ?outputPadding)
Parameters:
Tensor
-
The input tensor.
filters : Tensor
-
The filters.
?stride : int
-
The stride of the convolving kernel.
?padding : int
-
The implicit padding on both sides of the input.
?dilation : int
-
The spacing between kernel elements.
?outputPadding : int
-
The additional size added to one side of each dimension in the output shape.
Returns: Tensor
|
Applies a 1D transposed convolution operator over an input signal composed of several input planes, sometimes also called 'deconvolution'.
|
Full Usage:
dsharp.convTranspose2d (input, filters, ?stride, ?padding, ?dilation, ?outputPadding, ?strides, ?paddings, ?dilations, ?outputPaddings)
Parameters:
Tensor
-
The input tensor.
filters : Tensor
-
The filters.
?stride : int
-
The stride of the convolving kernel.
?padding : int
-
The implicit padding on both sides of the input.
?dilation : int
-
The spacing between kernel elements.
?outputPadding : int
-
The additional size added to one side of each dimension in the output shape.
?strides : seq<int>
-
The strides of the convolving kernel.
?paddings : seq<int>
-
The implicit paddings on corresponding sides of the input.
?dilations : seq<int>
-
The spacings between kernel elements.
?outputPaddings : seq<int>
-
The additional sizes added to one side of each dimension in the output shape.
Returns: Tensor
|
Applies a 2D transposed convolution operator over an input signal composed of several input planes, sometimes also called 'deconvolution'.
|
Full Usage:
dsharp.convTranspose3d (input, filters, ?stride, ?padding, ?dilation, ?outputPadding, ?strides, ?paddings, ?dilations, ?outputPaddings)
Parameters:
Tensor
-
The input tensor.
filters : Tensor
-
The filters.
?stride : int
-
The stride of the convolving kernel.
?padding : int
-
The implicit padding on both sides of the input.
?dilation : int
-
The spacing between kernel elements.
?outputPadding : int
-
The additional size added to one side of each dimension in the output shape.
?strides : seq<int>
-
The strides of the convolving kernel.
?paddings : seq<int>
-
The implicit paddings on corresponding sides of the input.
?dilations : seq<int>
-
The spacings between kernel elements.
?outputPaddings : seq<int>
-
The additional sizes added to one side of each dimension in the output shape.
Returns: Tensor
|
Applies a 3D transposed convolution operator over an input signal composed of several input planes, sometimes also called 'deconvolution'.
|
Full Usage:
dsharp.corrcoef input
Parameters:
Tensor
-
The input tensor.
Returns: Tensor
The correlation coefficient matrix \(R\) is computed from the covariance
matrix
Returns a square tensor representing the correlation coefficient matrix.
Given a tensor with \(N\) variables \(X=[x_1,x_2,\ldots,x_N]\) the
\(R_{i,j}\) entry on the correlation matrix is the correlation between
\(x_i\) and \(x_j\).
|
Estimates the Pearson correlation coefficient matrix for the given tensor. The tensor's first dimension should index variables and the second dimension should index observations for each variable. The correlation between variables \(x\) and \(y\) is \[cor(x,y)= \frac{\sum^{N}_{i = 1}(x_{i} - \mu_x)(y_{i} - \mu_y)}{\sigma_x \sigma_y (N ~-~1)}\] where \(\mu_x\) and \(\mu_y\) are the sample means and \(\sigma_x\) and \(\sigma_x\) are the sample standard deviations.
Example
let x = dsharp.tensor([-0.2678; -0.0908; -0.3766; 0.2780]) let y = dsharp.tensor([-0.5812; 0.1535; 0.2387; 0.2350]) let xy = dsharp.stack([x;y]) dsharp.corrcoef(xy)Evaluates to tensor([[1.0000, 0.3582], [0.3582, 1.0000]]) |
|
|
|
|
Full Usage:
dsharp.cov (input, ?correction, ?fweights, ?aweights)
Parameters:
Tensor
-
The input tensor.
?correction : int64
-
Difference between the sample size and the sample degrees of freedom. Defaults to 1 (Bessel's correction).
?fweights : Tensor
-
Frequency weights represent the number of times each observation was observed.
Should be given as a tensor of integers. Defaults to no weights.
?aweights : Tensor
-
Relative importance weights, larger weights for observations that
should have a larger effect on the estimate.
Should be given as a tensor of floating point numbers. Defaults to no weights.
Returns: Tensor
Returns a square tensor representing the covariance matrix.
Given a tensor with \(N\) variables \(X=[x_1,x_2,\ldots,x_N]\) the
\(C_{i,j}\) entry on the covariance matrix is the covariance between
\(x_i\) and \(x_j\).
|
Estimates the covariance matrix of the given tensor. The tensor's first dimension should index variables and the second dimension should index observations for each variable.
If no weights are given, the covariance between variables \(x\) and \(y\) is
\[cov(x,y)= \frac{\sum^{N}_{i = 1}(x_{i} - \mu_x)(y_{i} - \mu_y)}{N~-~\text{correction}}\]
where \(\mu_x\) and \(\mu_y\) are the sample means.
If there are fweights or aweights then the covariance is
\[cov(x,y)=\frac{\sum^{N}_{i = 1}w_i(x_{i} - \mu_x^*)(y_{i} - \mu_y^*)}{\text{normalization factor}}\]
where \(w\) is either fweights or aweights if one weight type is provided.
If both weight types are provided \(w=\text{fweights}\times\text{aweights}\).
\(\mu_x^* = \frac{\sum^{N}_{i = 1}w_ix_{i} }{\sum^{N}_{i = 1}w_i}\)
is the weighted mean of variables.
The normalization factor is \(\sum^{N}_{i=1} w_i\) if only fweights are provided or if aweights are provided and
Example
let x = dsharp.tensor([0.0;3.4;5.0]) let y = dsharp.tensor([1.0;2.3;-3.0]) let xy = dsharp.stack([x;y]) xy.cov()Evaluates to tensor([[ 6.5200, -4.0100], [-4.0100, 7.6300]]) |
Full Usage:
dsharp.create count value
Parameters:
int
-
The number of elements in the tensor.
value : 'a
-
The initial value for each element of the tensor.
Returns: Tensor
|
|
Full Usage:
dsharp.crossEntropyLoss (input, target, ?weight, ?reduction)
Parameters:
Tensor
-
The input tensor.
target : Tensor
-
The target tensor.
?weight : Tensor
-
A optional manual rescaling weight given to the loss of each batch element.
?reduction : string
-
Optionally specifies the reduction to apply to the output: 'none' | 'mean' | 'sum'. 'none': no reduction will be applied, 'mean': the sum of the output will be divided by the number of elements in the output, 'sum': the output will be summed. Note: size_average and reduce are in the process of being deprecated, and in the meantime, specifying either of those two args will override reduction. Default: 'mean'.
Returns: Tensor
|
|
|
|
|
|
Full Usage:
dsharp.devices (?backend, ?deviceType)
Parameters:
Backend
-
Return information for this backend. Defaults to Backend.Default.
?deviceType : DeviceType
-
If given, only return devices for this device type.
Returns: Device list
|
|
Full Usage:
dsharp.diagonal (input, ?offset, ?dim1, ?dim2)
Parameters:
Tensor
-
The input tensor. Must be at least 2-dimensional.
?offset : int
-
Which diagonal to consider. Default: 0.
?dim1 : int
-
The first dimension with respect to which to take diagonal. Default: 0..
?dim2 : int
-
The second dimension with respect to which to take diagonal. Default: 1.
Returns: Tensor
|
Returns a tensor with the diagonal elements with respect to
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Randomly zeroes some of the elements of the input tensor with probability p using samples from a Bernoulli distribution
|
|
Randomly zero out entire channels (a channel is a 2D feature map, e.g., the jj -th channel of the ii -th sample in the batched input is a 2D tensor \text{input}[i, j]input[i,j] ). Each channel will be zeroed out independently on every forward call with probability p using samples from a Bernoulli distribution
|
|
Randomly zero out entire channels (a channel is a 3D feature map, e.g., the jj -th channel of the ii -th sample in the batched input is a 3D tensor \text{input}[i, j]input[i,j] ). Each channel will be zeroed out independently on every forward call with probability p using samples from a Bernoulli distribution.
|
Full Usage:
dsharp.empty (?device, ?dtype, ?backend)
Parameters:
Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
|
Full Usage:
dsharp.empty (length, ?device, ?dtype, ?backend)
Parameters:
int
-
The length of the returned tensor.
?device : Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
Returns a new uninitialized tensor filled with arbitrary values for the given length, element type and configuration
|
Full Usage:
dsharp.empty (shape, ?device, ?dtype, ?backend)
Parameters:
seq<int>
-
The desired shape of returned tensor.
?device : Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
Returns a new uninitialized tensor filled with arbitrary values for the given shape, element type and configuration
|
|
Returns a boolean tensor for the element-wise equality comparison of the elements in the two tensors. The shapes of input and other don’t need to match, but they must be broadcastable.
|
|
|
|
|
|
|
|
|
Full Usage:
dsharp.eye (rows, ?cols, ?device, ?dtype, ?backend)
Parameters:
int
-
The number of rows
?cols : int
-
The number of columns with default being n
?device : Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
|
|
|
The |
|
Original value and transposed Jacobian-vector product of a vector-to-vector function `f`, at point `x`, along vector `v` |
|
The |
|
|
|
|
|
|
Returns a new tensor with the floor of the elements of input, the largest integer less than or equal to each element. The tensor will have the same element type as the input tensor.
|
|
|
Full Usage:
dsharp.full (length, value, ?device, ?dtype, ?backend)
Parameters:
int
-
The length of the returned tensor.
value : scalar
-
The scalar giving the the initial values for the tensor.
?device : Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
Returns a new tensor of the given length filled with value, for the given element type and configuration
|
Full Usage:
dsharp.full (shape, value, ?device, ?dtype, ?backend)
Parameters:
seq<int>
-
The desired shape of returned tensor.
value : scalar
-
The scalar used to form the initial values for the tensor.
?device : Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
Returns a new tensor filled with the scalar value, for the given shape, element type and configuration
|
Full Usage:
dsharp.fullLike (input, value, ?shape, ?device, ?dtype, ?backend)
Parameters:
Tensor
-
The shape and characteristics of input will determine those of the output tensor.
value : scalar
-
The scalar giving the the initial values for the tensor.
?shape : seq<int>
-
The desired shape of returned tensor. Default: If None, the shape of the input tensor is used.
?device : Device
-
The desired device of returned tensor. Default: if None, the device of the input tensor is used.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, the element type of the input tensor is used.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, the backend of the input tensor is used.
Returns: Tensor
|
Returns a new tensor filled with the given scalar value with characteristics based on the input tensor.
|
|
|
|
Returns a boolean tensor for the element-wise greater-than-or-equal comparison of the elements in the two tensors. The shapes of input and other don’t need to match, but they must be broadcastable.
|
|
|
|
|
|
Returns a boolean tensor for the element-wise greater-than comparison of the elements in the two tensors. The shapes of input and other don’t need to match, but they must be broadcastable.
|
|
|
|
|
|
|
|
|
Full Usage:
dsharp.init count initializer
Parameters:
int
-
The length of the tensor.
initializer : int -> 'a
-
The function used to initialize each element.
Returns: Tensor
|
|
Full Usage:
dsharp.init2d length1 length2 initializer
Parameters:
int
-
The length of the tensor in the first dimension.
length2 : int
-
The length of the tensor in the second dimension.
initializer : int -> int -> 'a
-
The function used to initialize each element.
Returns: Tensor
|
|
Full Usage:
dsharp.init3d length1 length2 length3 initializer
Parameters:
int
-
The length of the tensor in the 1st dimension.
length2 : int
-
The length of the tensor in the 2nd dimension.
length3 : int
-
The length of the tensor in the 3rd dimension.
initializer : int -> int -> int -> 'a
-
The function used to initialize each element.
Returns: Tensor
|
|
Full Usage:
dsharp.init4d length1 length2 length3 length4 initializer
Parameters:
int
-
The length of the tensor in the 1st dimension.
length2 : int
-
The length of the tensor in the 2nd dimension.
length3 : int
-
The length of the tensor in the 3rd dimension.
length4 : int
-
The length of the tensor in the 4th dimension.
initializer : int -> int -> int -> int -> 'a
-
The function used to initialize each element.
Returns: Tensor
|
|
|
|
Full Usage:
dsharp.isCudaAvailable ?backend
Parameters:
Backend
-
Return information for this backend. Defaults to Backend.Default.
Returns: bool
|
|
|
|
Full Usage:
dsharp.isDeviceTypeAvailable (deviceType, ?backend)
Parameters:
DeviceType
-
The requested device type.
?backend : Backend
-
Return information for this backend. Defaults to Backend.Default.
Returns: bool
|
|
Full Usage:
dsharp.isTensor value
Parameters:
obj
Returns: bool
|
|
|
Returns a boolean tensor where each element indicates if the corresponding element in the input tensor is an infinity value.
|
|
Returns a boolean tensor where each element indicates if the corresponding element in the input tensor is a NaN (not-a-number) value.
|
|
|
Transposed Jacobian-vector product of a vector-to-vector function `f`, at point `x`, along vector `v`
|
|
|
|
|
|
|
Return a boolean tensor for the element-wise less-than-or-equal comparison of the elements in the two tensors. The shapes of input and other don’t need to match, but they must be broadcastable.
|
|
\[\text{LeakyReLU}(x) = \max(0, x) + \text{negative\_slope} * \min(0, x)\]
|
Full Usage:
dsharp.like (input, value, ?device, ?dtype, ?backend)
Parameters:
Tensor
-
The shape and characteristics of input will determine those of the output tensor.
value : obj
-
The .NET object giving the the initial values for the tensor.
?device : Device
-
The desired device of returned tensor. Default: if None, the device of the input tensor is used.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, the element type of the input tensor is used.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, the backend of the input tensor is used.
Returns: Tensor
|
|
Full Usage:
dsharp.linspace (startVal, endVal, steps, ?device, ?dtype, ?backend)
Parameters:
int
-
The starting value for the set of points.
endVal : int
-
The ending value for the set of points.
steps : int
-
The size of the returned tensor.
?device : Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
Returns a 1-D tensor of size steps whose values are evenly spaced from startVal to endVal. The values are going to be: \( (\text{startVal}, \text{startVal} + \frac{\text{endVal} - \text{startVal}}{\text{steps} - 1}, \ldots, \text{startVal} + (\text{steps} - 2) * \frac{\text{endVal} - \text{startVal}}{\text{steps} - 1}, \text{endVal}) \)
|
Full Usage:
dsharp.linspace (startVal, endVal, steps, ?device, ?dtype, ?backend)
Parameters:
float
-
The starting value for the set of points.
endVal : float
-
The ending value for the set of points.
steps : int
-
The size of the returned tensor.
?device : Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
Returns a 1-D tensor of size steps whose values are evenly spaced from startVal to endVal. The values are going to be: \( (\text{startVal}, \text{startVal} + \frac{\text{endVal} - \text{startVal}}{\text{steps} - 1}, \ldots, \text{startVal} + (\text{steps} - 2) * \frac{\text{endVal} - \text{startVal}}{\text{steps} - 1}, \text{endVal}) \)
|
Full Usage:
dsharp.load fileName
Parameters:
string
Returns: 'b
|
The format used may change from version to version of DiffSharp.
|
|
\[y_{i} = \log_{e} (x_{i})\]
|
|
\[y_{i} = \log_{10} (x_{i})\]
|
|
|
Full Usage:
dsharp.logspace (startVal, endVal, steps, ?baseVal, ?device, ?dtype, ?backend)
Parameters:
int
-
The starting value for the set of points.
endVal : int
-
The ending value for the set of points.
steps : int
-
The size of the returned tensor.
?baseVal : int
-
The base of the logarithm. Default: 10.
?device : Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
Returns a 1-D tensor of size steps whose values are evenly spaced logarithmically from \(\text{baseVal}^{\text{startVal}}\) to \(\text{baseVal}^{\text{endVal}}\). The values are going to be: \( (\text{baseVal}^{\text{startVal}}, \text{baseVal}^{(\text{startVal} + \frac{\text{endVal} - \text{startVal}}{ \text{steps} - 1})}, \ldots, \text{baseVal}^{(\text{startVal} + (\text{steps} - 2) * \frac{\text{endVal} - \text{startVal}}{ \text{steps} - 1})}, \text{baseVal}^{\text{endVal}}) \)
|
Full Usage:
dsharp.logspace (startVal, endVal, steps, ?baseVal, ?device, ?dtype, ?backend)
Parameters:
float
-
The starting value for the set of points.
endVal : float
-
The ending value for the set of points.
steps : int
-
The size of the returned tensor.
?baseVal : float
-
The base of the logarithm. Default: 10.0.
?device : Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
Returns a 1-D tensor of size steps whose values are evenly spaced logarithmically from \(\text{baseVal}^{\text{startVal}}\) to \(\text{baseVal}^{\text{endVal}}\). The values are going to be: \( (\text{baseVal}^{\text{startVal}}, \text{baseVal}^{(\text{startVal} + \frac{\text{endVal} - \text{startVal}}{ \text{steps} - 1})}, \ldots, \text{baseVal}^{(\text{startVal} + (\text{steps} - 2) * \frac{\text{endVal} - \text{startVal}}{ \text{steps} - 1})}, \text{baseVal}^{\text{endVal}}) \)
|
|
|
|
Returns a boolean tensor for the element-wise less-than comparison of the elements in the two tensors. The shapes of input and other don’t need to match, but they must be broadcastable.
|
|
|
The shapes of the two tensors must be identical.
|
|
Full Usage:
dsharp.map3 mapping tensor1 tensor2 tensor3
Parameters:
Tensor -> Tensor -> Tensor -> Tensor
-
The function to apply to each element of the tensor.
tensor1 : Tensor
-
The first input tensor.
tensor2 : Tensor
-
The second input tensor.
tensor3 : Tensor
-
The third input tensor.
Returns: Tensor
|
The shapes of the three tensors must be identical.
|
|
|
|
The function is passed the index of each element. The shapes of the two tensors must be identical.
|
Full Usage:
dsharp.mapi3 mapping tensor1 tensor2 tensor3
Parameters:
int[] -> Tensor -> Tensor -> Tensor -> Tensor
-
The function to apply to each element of the tensor.
tensor1 : Tensor
-
The first input tensor.
tensor2 : Tensor
-
The second input tensor.
tensor3 : Tensor
-
The third input tensor.
Returns: Tensor
|
The function is passed the index of each element. The shapes of the three tensors must be identical.
|
|
|
|
|
|
Each element of the tensor input is compared with the corresponding element of the tensor other and an element-wise maximum is taken. The shapes of input and other don’t need to match, but they must be broadcastable.
|
|
|
Full Usage:
dsharp.maxpool1d (input, kernelSize, ?stride, ?padding)
Parameters:
Tensor
-
The input tensor.
kernelSize : int
-
The size of the window to take a max over.
?stride : int
-
The stride of the window. Default value is kernelSize.
?padding : int
-
The implicit zero padding to be added on both sides.
Returns: Tensor
|
|
Full Usage:
dsharp.maxpool1di (input, kernelSize, ?stride, ?padding)
Parameters:
Tensor
-
The input tensor.
kernelSize : int
-
The size of the window to take a max over.
?stride : int
-
The stride of the window. Default value is kernelSize.
?padding : int
-
The implicit zero padding to be added on both sides.
Returns: Tensor * Tensor
|
Applies a 1D max pooling over an input signal composed of several input planes, returning the max indices along with the outputs.
|
Full Usage:
dsharp.maxpool2d (input, ?kernelSize, ?stride, ?padding, ?kernelSizes, ?strides, ?paddings)
Parameters:
Tensor
-
The input tensor.
?kernelSize : int
-
The size of the window to take a max over.
?stride : int
-
The stride of the window. Default value is kernelSize.
?padding : int
-
The implicit zero padding to be added on both sides.
?kernelSizes : seq<int>
-
The sizes of the window to take a max over.
?strides : seq<int>
-
The strides of the window. Default value is kernelSize.
?paddings : seq<int>
-
The implicit zero paddings to be added on corresponding sides.
Returns: Tensor
|
|
Full Usage:
dsharp.maxpool2di (input, ?kernelSize, ?stride, ?padding, ?kernelSizes, ?strides, ?paddings)
Parameters:
Tensor
-
The input tensor.
?kernelSize : int
-
The size of the window to take a max over.
?stride : int
-
The stride of the window. Default value is kernelSize.
?padding : int
-
The implicit zero padding to be added on both sides.
?kernelSizes : seq<int>
-
The sizes of the window to take a max over.
?strides : seq<int>
-
The strides of the window. Default value is kernelSize.
?paddings : seq<int>
-
The implicit zero paddings to be added on corresponding sides.
Returns: Tensor * Tensor
|
Applies a 2D max pooling over an input signal composed of several input planes, returning the max indices along with the outputs.
|
Full Usage:
dsharp.maxpool3d (input, ?kernelSize, ?stride, ?padding, ?kernelSizes, ?strides, ?paddings)
Parameters:
Tensor
-
The input tensor.
?kernelSize : int
-
The size of the window to take a max over.
?stride : int
-
The stride of the window. Default value is kernelSize.
?padding : int
-
The implicit zero padding to be added on both sides.
?kernelSizes : seq<int>
-
The sizes of the window to take a max over.
?strides : seq<int>
-
The strides of the window. Default value is kernelSizes.
?paddings : seq<int>
-
The implicit zero paddings to be added on corresponding sides.
Returns: Tensor
|
|
Full Usage:
dsharp.maxpool3di (input, ?kernelSize, ?stride, ?padding, ?kernelSizes, ?strides, ?paddings)
Parameters:
Tensor
-
The input tensor.
?kernelSize : int
-
The size of the window to take a max over.
?stride : int
-
The stride of the window. Default value is kernelSize.
?padding : int
-
The implicit zero padding to be added on both sides.
?kernelSizes : seq<int>
-
The sizes of the window to take a max over.
?strides : seq<int>
-
The strides of the window. Default value is kernelSize.
?paddings : seq<int>
-
The implicit zero paddings to be added on corresponding sides.
Returns: Tensor * Tensor
|
Applies a 3D max pooling over an input signal composed of several input planes, returning the max indices along with the outputs.
|
Full Usage:
dsharp.maxunpool1d (input, indices, kernelSize, ?stride, ?padding, ?outputSize)
Parameters:
Tensor
-
The input tensor.
indices : Tensor
-
The indices selected by maxpool1di.
kernelSize : int
-
The size of the window to take a max over.
?stride : int
-
The stride of the window. Default value is kernelSize.
?padding : int
-
The implicit zero padding to be added on both sides.
?outputSize : seq<int>
-
The targeted output size.
Returns: Tensor
|
|
Full Usage:
dsharp.maxunpool2d (input, indices, ?kernelSize, ?stride, ?padding, ?kernelSizes, ?strides, ?paddings, ?outputSize)
Parameters:
Tensor
-
The input tensor.
indices : Tensor
-
The indices selected by maxpool2di.
?kernelSize : int
-
The size of the window to take a max over.
?stride : int
-
The stride of the window. Default value is kernelSize.
?padding : int
-
The implicit zero padding to be added on both sides.
?kernelSizes : seq<int>
-
The sizes of the window to take a max over.
?strides : seq<int>
-
The strides of the window. Default value is kernelSizes.
?paddings : seq<int>
-
The implicit zero paddings to be added on corresponding sides.
?outputSize : seq<int>
-
The targeted output size.
Returns: Tensor
|
|
Full Usage:
dsharp.maxunpool3d (input, indices, ?kernelSize, ?stride, ?padding, ?kernelSizes, ?strides, ?paddings, ?outputSize)
Parameters:
Tensor
-
The input tensor.
indices : Tensor
-
The indices selected by maxpool3di.
?kernelSize : int
-
The size of the window to take a max over.
?stride : int
-
The stride of the window. Default value is kernelSize.
?padding : int
-
The implicit zero padding to be added on both sides.
?kernelSizes : seq<int>
-
The sizes of the window to take a max over.
?strides : seq<int>
-
The strides of the window. Default value is kernelSizes.
?paddings : seq<int>
-
The implicit zero paddings to be added on corresponding sides.
?outputSize : seq<int>
-
The targeted output size.
Returns: Tensor
|
|
|
Returns the mean value of each row of the input tensor in the given dimension dim. If dim is a list of dimensions, reduce over all of them. 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, resulting in the output tensor having 1 (or len(dim)) fewer dimension(s).
|
|
|
|
|
|
Each element of the tensor input is compared with the corresponding element of the tensor other and an element-wise minimum is taken. The shapes of input and other don’t need to match, but they must be broadcastable.
|
|
|
Full Usage:
dsharp.move (input, ?device, ?dtype, ?backend)
Parameters:
Tensor
-
The input tensor.
?device : Device
-
The desired device of returned tensor. Default: if None, the device of the input tensor is used.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, the element type of the input tensor is used.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, the backend of the input tensor is used.
Returns: Tensor
|
If the characteristics are unchanged the input tensor will be returned.
|
Full Usage:
dsharp.mseLoss (input, target, ?reduction)
Parameters:
Tensor
-
The input tensor.
target : Tensor
-
The target tensor.
?reduction : string
-
Optionally specifies the reduction to apply to the output: 'none' | 'mean' | 'sum'. 'none': no reduction will be applied, 'mean': the sum of the output will be divided by the number of elements in the output, 'sum': the output will be summed. Note: size_average and reduce are in the process of being deprecated, and in the meantime, specifying either of those two args will override reduction. Default: 'mean'.
Returns: Tensor
|
Creates a criterion that measures the mean squared error (squared L2 norm) between each element in the input and the target.
|
|
|
Full Usage:
dsharp.multinomial (probs, numSamples, ?normalize, ?device, ?dtype, ?backend)
Parameters:
Tensor
-
The input tensor containing probabilities.
numSamples : int
-
The number of samples to draw.
?normalize : bool
-
Indicates where the probabilities should first be normalized by their sum.
?device : Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
Returns a tensor where each row contains numSamples indices sampled from the multinomial probability distribution located in the corresponding row of tensor input.
|
|
Returns a boolean tensor for the element-wise non-equality comparison of the elements in the two tensors. The shapes of input and other don’t need to match, but they must be broadcastable.
|
|
|
|
|
Full Usage:
dsharp.nest level
Parameters:
uint32
-
The new nesting level.
|
|
Full Usage:
dsharp.nest ()
|
|
Full Usage:
dsharp.nestLevel ()
Returns: uint32
|
|
Full Usage:
dsharp.nestReset ()
|
|
Full Usage:
dsharp.nllLoss (input, target, ?weight, ?reduction)
Parameters:
Tensor
-
The input tensor.
target : Tensor
-
The target tensor.
?weight : Tensor
-
A optional manual rescaling weight given to the loss of each batch element.
?reduction : string
-
Optionally specifies the reduction to apply to the output: 'none' | 'mean' | 'sum'. 'none': no reduction will be applied, 'mean': the sum of the output will be divided by the number of elements in the output, 'sum': the output will be summed. Note: size_average and reduce are in the process of being deprecated, and in the meantime, specifying either of those two args will override reduction. Default: 'mean'.
Returns: Tensor
|
|
|
|
|
|
Full Usage:
dsharp.one (?device, ?dtype, ?backend)
Parameters:
Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
|
Full Usage:
dsharp.oneLike (input, ?device, ?dtype, ?backend)
Parameters:
Tensor
-
The shape and characteristics of input will determine those of the output tensor.
?device : Device
-
The desired device of returned tensor. Default: if None, the device of the input tensor is used.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, the element type of the input tensor is used.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, the backend of the input tensor is used.
Returns: Tensor
|
|
Full Usage:
dsharp.onehot (length, hot, ?device, ?dtype, ?backend)
Parameters:
int
-
The length of the returned tensor.
hot : int
-
The location to set to 1.
?device : Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
|
Full Usage:
dsharp.onehotLike (input, length, hot, ?device, ?dtype, ?backend)
Parameters:
Tensor
-
The shape and characteristics of input will determine those of the output tensor.
length : int
-
The length of the returned tensor.
hot : int
-
The location to set to 1.
?device : Device
-
The desired device of returned tensor. Default: if None, the device of the input tensor is used.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, the element type of the input tensor is used.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, the backend of the input tensor is used.
Returns: Tensor
|
|
Full Usage:
dsharp.ones (length, ?device, ?dtype, ?backend)
Parameters:
int
-
The length of the returned tensor.
?device : Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
Returns a new tensor of the given length filled with '1' values for the given element type and configuration
|
Full Usage:
dsharp.ones (shape, ?device, ?dtype, ?backend)
Parameters:
seq<int>
-
The desired shape of returned tensor.
?device : Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
|
Full Usage:
dsharp.onesLike (input, ?shape, ?device, ?dtype, ?backend)
Parameters:
Tensor
-
The shape and characteristics of input will determine those of the output tensor.
?shape : seq<int>
-
The desired shape of returned tensor. Default: If None, the shape of the input tensor is used.
?device : Device
-
The desired device of returned tensor. Default: if None, the device of the input tensor is used.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, the element type of the input tensor is used.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, the backend of the input tensor is used.
Returns: Tensor
|
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
dsharp.rand (length, ?device, ?dtype, ?backend)
Parameters:
int
-
The length of the returned tensor.
?device : Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
|
Full Usage:
dsharp.rand (shape, ?device, ?dtype, ?backend)
Parameters:
seq<int>
-
The desired shape of returned tensor.
?device : Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
|
Full Usage:
dsharp.randLike (input, ?shape, ?device, ?dtype, ?backend)
Parameters:
Tensor
-
The shape and characteristics of input will determine those of the output tensor.
?shape : seq<int>
-
The desired shape of returned tensor. Default: If None, the shape of the input tensor is used.
?device : Device
-
The desired device of returned tensor. Default: if None, the device of the input tensor is used.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, the element type of the input tensor is used.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, the backend of the input tensor is used.
Returns: Tensor
|
Returns a tensor filled with random numbers from a uniform distribution on the interval [0, 1) with characteristics based on the input tensor
|
Full Usage:
dsharp.randint (low, high, length, ?device, ?dtype, ?backend)
Parameters:
int
-
Lowest integer to be drawn from the distribution. Default: 0..
high : int
-
One above the highest integer to be drawn from the distribution.
length : int
-
The length of the returned tensor.
?device : Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
Returns a tensor filled with random integers generated uniformly between low (inclusive) and high (exclusive).
|
Full Usage:
dsharp.randint (low, high, shape, ?device, ?dtype, ?backend)
Parameters:
int
-
Lowest integer to be drawn from the distribution. Default: 0..
high : int
-
One above the highest integer to be drawn from the distribution.
shape : seq<int>
-
The desired shape of returned tensor.
?device : Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
Returns a tensor filled with random integers generated uniformly between low (inclusive) and high (exclusive).
|
Full Usage:
dsharp.randintLike (input, low, high, ?shape, ?device, ?dtype, ?backend)
Parameters:
Tensor
-
The shape and characteristics of input will determine those of the output tensor.
low : int
-
Lowest integer to be drawn from the distribution. Default: 0..
high : int
-
One above the highest integer to be drawn from the distribution.
?shape : seq<int>
-
The desired shape of returned tensor. Default: If None, the shape of the input tensor is used.
?device : Device
-
The desired device of returned tensor. Default: if None, the device of the input tensor is used.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, the element type of the input tensor is used.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, the backend of the input tensor is used.
Returns: Tensor
|
Returns a tensor with the same shape as Tensor input filled with random integers generated uniformly between low (inclusive) and high (exclusive) with characteristics based on the input tensor.
|
Full Usage:
dsharp.randn (length, ?device, ?dtype, ?backend)
Parameters:
int
-
The length of the returned tensor.
?device : Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
Returns a tensor filled with random numbers from a normal distribution with mean 0 and variance 1 (also called the standard normal distribution).
|
Full Usage:
dsharp.randn (shape, ?device, ?dtype, ?backend)
Parameters:
seq<int>
-
The desired shape of returned tensor.
?device : Device
-
The desired device of returned tensor. Default: if None, uses Device.Default.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, uses Dtype.Default.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, uses Backend.Default.
Returns: Tensor
|
Returns a tensor filled with random numbers from a normal distribution with mean 0 and variance 1 (also called the standard normal distribution).
|
Full Usage:
dsharp.randnLike (input, ?shape, ?device, ?dtype, ?backend)
Parameters:
Tensor
-
The shape and characteristics of input will determine those of the output tensor.
?shape : seq<int>
-
The desired shape of returned tensor. Default: If None, the shape of the input tensor is used.
?device : Device
-
The desired device of returned tensor. Default: if None, the device of the input tensor is used.
?dtype : Dtype
-
The desired element type of returned tensor. Default: if None, the element type of the input tensor is used.
?backend : Backend
-
The desired backend of returned tensor. Default: if None, the backend of the input tensor is used.
Returns: Tensor
|
Returns a tensor filled with random numbers from a normal distribution with mean 0 and variance 1 (also called the standard normal distribution) with characteristics based on the input tensor.
|
|
|
|
|
|
|
|
|
|
|
|
|
|