Tensor operations
| Static member |
Description
|
|
|
|
|
|
|
Full Usage:
dfx.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:
dfx.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:
dfx.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
|
A version of dfx.arange with characteristics based on the input tensor.
|
Full Usage:
dfx.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
|
A version of dfx.arange with characteristics based on the input tensor.
|
|
|
|
Returns the indices of the maximum value of all elements in the input tensor.
|
|
|
|
Returns the indices of the minimum value of all elements in the input tensor.
|
|
|
|
|
|
Returns the list of available backends.
|
|
|
Full Usage:
dfx.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
|
Creates a criterion that measures the Binary Cross Entropy between the target and the output
|
Full Usage:
dfx.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
|
Draws binary random numbers (0 or 1) from a Bernoulli distribution
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
dfx.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:
dfx.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
|
Applies a 1D convolution over an input signal composed of several input planes
|
Full Usage:
dfx.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 : int seq
-
The strides of the convolving kernel.
?padding : int
-
The implicit padding on corresponding sides of the input.
?paddings : int seq
-
The implicit paddings on corresponding sides of the input.
?dilation : int
-
The spacing between kernel elements.
?dilations : int seq
-
The spacings between kernel elements.
Returns: Tensor
|
Applies a 2D convolution over an input signal composed of several input planes
|
Full Usage:
dfx.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 : int seq
-
The strides of the convolving kernel.
?padding : int
-
The implicit padding on corresponding sides of the input.
?paddings : int seq
-
The implicit paddings on corresponding sides of the input.
?dilation : int
-
The spacing between kernel elements.
?dilations : int seq
-
The spacings between kernel elements.
Returns: Tensor
|
Applies a 3D convolution over an input signal composed of several input planes
|
Full Usage:
dfx.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:
dfx.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 : int seq
-
The strides of the convolving kernel.
?paddings : int seq
-
The implicit paddings on corresponding sides of the input.
?dilations : int seq
-
The spacings between kernel elements.
?outputPaddings : int seq
-
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:
dfx.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 : int seq
-
The strides of the convolving kernel.
?paddings : int seq
-
The implicit paddings on corresponding sides of the input.
?dilations : int seq
-
The spacings between kernel elements.
?outputPaddings : int seq
-
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:
dfx.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
val x: obj
val y: obj
val xy: obj
Evaluates to
|
|
|
|
|
Full Usage:
dfx.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
val x: obj
val y: obj
val xy: obj
Evaluates to
|
Full Usage:
dfx.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
Type parameters: 'a |
Create a new 1D tensor using the given value for each element.
|
Full Usage:
dfx.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
|
This criterion combines logsoftmax and nllLoss in a single function
|
|
|
|
|
Full Usage:
dfx.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
|
Returns the list of available devices for a given backend.
|
Full Usage:
dfx.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 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:
dfx.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
|
Returns a new empty tensor holding no data, for the given element type and configuration
|
Full Usage:
dfx.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:
dfx.empty (shape, ?device, ?dtype, ?backend)
Parameters:
int seq
-
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
|
|
|
|
|
|
|
|
|
Full Usage:
dfx.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
|
Returns a 2-D tensor with ones on the diagonal and zeros elsewhere.
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
dfx.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:
dfx.full (shape, value, ?device, ?dtype, ?backend)
Parameters:
int seq
-
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:
dfx.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 : int seq
-
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 indicating if any element of the tensor is infinite.
|
|
Returns a boolean indicating if any element of the tensor is a not-a-number (NaN) value.
|
|
|
Full Usage:
dfx.init count initializer
Parameters:
int
-
The length of the tensor.
initializer : int -> 'a
-
The function used to initialize each element.
Returns: Tensor
Type parameters: 'a |
Create a new 1D tensor using the given initializer for each element.
|
Full Usage:
dfx.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
Type parameters: 'a |
Create a new 2D tensor using the given initializer for each element.
|
Full Usage:
dfx.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
Type parameters: 'a |
Create a new 3D tensor using the given initializer for each element.
|
Full Usage:
dfx.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
Type parameters: 'a |
Create a new 4D tensor using the given initializer for each element.
|
|
|
Full Usage:
dfx.isCudaAvailable ?backend
Parameters:
Backend
-
Return information for this backend. Defaults to Backend.Default.
Returns: bool
|
Indicates if CUDA is available for a given backend.
|
|
|
Full Usage:
dfx.isDeviceTypeAvailable (deviceType, ?backend)
Parameters:
DeviceType
-
The requested device type.
?backend : Backend
-
Return information for this backend. Defaults to Backend.Default.
Returns: bool
|
Indicates if a given device type is available for a given backend.
|
Full Usage:
dfx.isTensor value
Parameters:
obj
Returns: bool
|
Indicates if an object is a tensor
|
|
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
dfx.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
|
Returns a new tensor based on the given .NET value with characteristics based on the input tensor.
|
Full Usage:
dfx.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:
dfx.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:
dfx.load fileName
Parameters:
string
Returns: 'a
Type parameters: 'a |
Loads an object from the given file using a bespoke binary format. The format used may change from version to version of Dfx.
|
|
|
|
|
|
|
Full Usage:
dfx.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:
dfx.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}}) \)
|
|
|
|
|
|
|
Produce a new tensor by mapping a function over all corresponding elements of two input tensors. The shapes of the two tensors must be identical.
|
|
Full Usage:
dfx.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
|
Produce a new tensor by mapping a function over all corresponding elements of three input tensors. The shapes of the three tensors must be identical.
|
|
|
Produce a new tensor by mapping a function over all corresponding elements of two input tensors. The function is passed the index of each element. The shapes of the two tensors must be identical.
|
|
Full Usage:
dfx.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
|
Produce a new tensor by mapping a function over all corresponding elements of three input tensors. The function is passed the index of each element. The shapes of the three tensors must be identical.
|
|
|
|
|
|
|
|
|
Full Usage:
dfx.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
|
Applies a 1D max pooling over an input signal composed of several input planes.
|
Full Usage:
dfx.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:
dfx.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 : int seq
-
The sizes of the window to take a max over.
?strides : int seq
-
The strides of the window. Default value is kernelSize.
?paddings : int seq
-
The implicit zero paddings to be added on corresponding sides.
Returns: Tensor
|
Applies a 2D max pooling over an input signal composed of several input planes.
|
Full Usage:
dfx.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 : int seq
-
The sizes of the window to take a max over.
?strides : int seq
-
The strides of the window. Default value is kernelSize.
?paddings : int seq
-
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:
dfx.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 : int seq
-
The sizes of the window to take a max over.
?strides : int seq
-
The strides of the window. Default value is kernelSizes.
?paddings : int seq
-
The implicit zero paddings to be added on corresponding sides.
Returns: Tensor
|
Applies a 3D max pooling over an input signal composed of several input planes.
|
Full Usage:
dfx.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 : int seq
-
The sizes of the window to take a max over.
?strides : int seq
-
The strides of the window. Default value is kernelSize.
?paddings : int seq
-
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:
dfx.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 : int seq
-
The targeted output size.
Returns: Tensor
|
Computes a partial inverse of maxpool1di
|
Full Usage:
dfx.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 : int seq
-
The sizes of the window to take a max over.
?strides : int seq
-
The strides of the window. Default value is kernelSizes.
?paddings : int seq
-
The implicit zero paddings to be added on corresponding sides.
?outputSize : int seq
-
The targeted output size.
Returns: Tensor
|
Computes a partial inverse of maxpool2di
|
Full Usage:
dfx.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 : int seq
-
The sizes of the window to take a max over.
?strides : int seq
-
The strides of the window. Default value is kernelSizes.
?paddings : int seq
-
The implicit zero paddings to be added on corresponding sides.
?outputSize : int seq
-
The targeted output size.
Returns: Tensor
|
Computes a partial inverse of maxpool3di
|
|
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).
|
|
|
|
|
|
|
|
|
Full Usage:
dfx.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
|
Move the tensor to a difference device, backend and/or change its element type. If the characteristics are unchanged the input tensor will be returned.
|
Full Usage:
dfx.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:
dfx.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 the total number of elements in the input tensor.
|
Full Usage:
dfx.nest level
Parameters:
uint32
-
The new nesting level.
|
Set the global nesting level for automatic differentiation.
|
Full Usage:
dfx.nest ()
|
Increase the global nesting level for automatic differentiation. |
Full Usage:
dfx.nestLevel ()
Returns: uint32
|
Get the global nesting level for automatic differentiation.
|
Full Usage:
dfx.nestReset ()
|
Reset the global nesting level for automatic differentiation to zero. |
Full Usage:
dfx.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
|
The negative log likelihood loss.
|
|
|
|
|
Full Usage:
dfx.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
|
Get the scalar '1' tensor for the given configuration
|
Full Usage:
dfx.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
|
Returns the '0' scalar tensor with characteristics based on the input tensor.
|
Full Usage:
dfx.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
|
Returns a one-hot tensor, with one location set to 1, and all others 0.
|
Full Usage:
dfx.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
|
A version of dfx.onehot with characteristics based on the input tensor.
|
Full Usage:
dfx.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:
dfx.ones (shape, ?device, ?dtype, ?backend)
Parameters:
int seq
-
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 tensor filled with '1' values for the given shape, element type and configuration
|
Full Usage:
dfx.onesLike (input, ?shape, ?device, ?dtype, ?backend)
Parameters:
Tensor
-
The shape and characteristics of input will determine those of the output tensor.
?shape : int seq
-
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 '1' values with characteristics based on the input tensor.
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
dfx.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
|
Returns a tensor filled with random numbers from a uniform distribution on the interval [0, 1)
|
Full Usage:
dfx.rand (shape, ?device, ?dtype, ?backend)
Parameters:
int seq
-
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 uniform distribution on the interval [0, 1)
|
Full Usage:
dfx.randLike (input, ?shape, ?device, ?dtype, ?backend)
Parameters:
Tensor
-
The shape and characteristics of input will determine those of the output tensor.
?shape : int seq
-
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:
dfx.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:
dfx.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 : int seq
-
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:
dfx.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 : int seq
-
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:
dfx.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:
dfx.randn (shape, ?device, ?dtype, ?backend)
Parameters:
int seq
-
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:
dfx.randnLike (input, ?shape, ?device, ?dtype, ?backend)
Parameters:
Tensor
-
The shape and characteristics of input will determine those of the output tensor.
?shape : int seq
-
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.
|
|
|
|
|
|
|
|
|
|
|
|
Reset the reverse mode computation associated with the given output tensor.
|
|
|
|
Returns the logarithm of the tensor after clamping the tensor so that all its elements are greater than epsilon. This is to avoid a -inf result for elements equal to zero.
|
Full Usage:
dfx.save (value, fileName)
Parameters:
obj
fileName : string
|
Saves the object to the given file using a bespoke binary format. The format used may change from version to version of Dfx.
|
Full Usage:
dfx.scalar (value, ?device, ?dtype, ?backend)
Parameters:
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 scalar tensor with the value value, for the given element type and configuration
|
|
|
Full Usage:
dfx.seed ?seed
Parameters:
int
|
Seeds all backends with the given random seed, or a new seed based on the current time if no seed is specified.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Splits the tensor into chunks. The tensor will be split into sizes.Length chunks each with a corresponding size in the given dimension.
|
|
|
|
Returns a tensor with all the dimensions of input of size 1 removed. If the tensor has a batch dimension of size 1, then squeeze(input) will also remove the batch dimension, which can lead to unexpected errors.
|
|
|
|
|
|
Returns the standard deviation 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). If unbiased is False, then the standard deviation will be calculated via the biased estimator. Otherwise, Bessel’s correction will be used.
|
|
Returns the standard deviation of all elements in the input tensor. If unbiased is False, then the standard deviation will be calculated via the biased estimator. Otherwise, Bessel’s correction will be used.
|
|
|
|
Returns the sum 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).
|
|
|
|
|
|
|
Full Usage:
dfx.tensor (value, ?device, ?dtype, ?backend)
Parameters:
obj
-
The .NET object 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
|
Creates a new tensor from the given data, using the given element type and configuration. The data is converted from arrays, sequences, lists and tuples of primitive values to a tensor whose shape is inferred from the data. The fastest creation technique is a one dimensional array matching the desired dtype. Then use 'view' to reshape.
Example
val t1: obj
val t2: obj
|
Full Usage:
dfx.toImage (input, ?pixelMin, ?pixelMax, ?normalize, ?gridCols)
Parameters:
Tensor
-
The input tensor.
?pixelMin : double
-
The minimum pixel value.
?pixelMax : double
-
The maximum pixel value.
?normalize : bool
-
If True, shift the image to the range (0, 1), by the min and max values specified by range.
?gridCols : int
-
Number of columns of images in the grid.
Returns: Tensor
|
Convert tensor to an image tensor with shape Channels x Height x Width If the input tensor has 4 dimensions, then make a single image grid.
|
Full Usage:
dfx.toImageString (input, ?pixelMin, ?pixelMax, ?normalize, ?gridCols, ?asciiPalette)
Parameters:
Tensor
-
The input tensor.
?pixelMin : double
-
The minimum pixel value.
?pixelMax : double
-
The maximum pixel value.
?normalize : bool
-
If True, shift the image to the range (0, 1), by the min and max values specified by range.
?gridCols : int
-
Number of columns of images in the grid.
?asciiPalette : string
-
The ASCII pallette to use.
Returns: string
|
Convert tensor to a grayscale image tensor and return a string representation approximating grayscale values
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Returns the variance 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). If unbiased is False, then the variance will be calculated via the biased estimator. Otherwise, Bessel’s correction will be used.
|
|
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.
|
Full Usage:
dfx.version
Returns: string
|
Returns the version of the Dfx.Core assembly.
|
|
Returns a new tensor with the same data as the self tensor but of a different shape. The returned tensor shares the same data and must have the same number of elements, but may have a different size. For a tensor to be viewed, the new view size must be compatible with its original size. The returned tensor shares the same data and must have the same number of elements, but may have a different size. For a tensor to be viewed, the new view size must be compatible with its original size and stride, i.e., each new view dimension must either be a subspace of an original dimension, or only span across original dimensions \(d, d+1, \dots, d+kd,d+1,…,d+k\) that satisfy the following contiguity-like condition that \(\forall i = d, \dots, d+k-1∀i=d,…,d+k−1 ,\) \[\text{stride}[i] = \text{stride}[i+1] \times \text{size}[i+1]\]
|
|
Returns a new tensor with the same data as the self tensor but of a different shape. The returned tensor shares the same data and must have the same number of elements, but may have a different size. For a tensor to be viewed, the new view size must be compatible with its original size. The returned tensor shares the same data and must have the same number of elements, but may have a different size. For a tensor to be viewed, the new view size must be compatible with its original size and stride, i.e., each new view dimension must either be a subspace of an original dimension, or only span across original dimensions \(d, d+1, \dots, d+kd,d+1,…,d+k\) that satisfy the following contiguity-like condition that \(\forall i = d, \dots, d+k-1∀i=d,…,d+k−1 ,\) \[\text{stride}[i] = \text{stride}[i+1] \times \text{size}[i+1]\]
|
|
View this tensor as the same size as other. The returned tensor shares the same data and must have the same number of elements, but may have a different size. For a tensor to be viewed, the new view size must be compatible with its original size. The returned tensor shares the same data and must have the same number of elements, but may have a different size. For a tensor to be viewed, the new view size must be compatible with its original size and stride, i.e., each new view dimension must either be a subspace of an original dimension, or only span across original dimensions \(d, d+1, \dots, d+kd,d+1,…,d+k\) that satisfy the following contiguity-like condition that \(\forall i = d, \dots, d+k-1∀i=d,…,d+k−1 ,\) \[\text{stride}[i] = \text{stride}[i+1] \times \text{size}[i+1]\]
|
Full Usage:
dfx.zero (?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
|
Get the scalar zero tensor for the given configuration
|
Full Usage:
dfx.zeroCreate count
Parameters:
int
-
The number of elements in the tensor.
Returns: Tensor
|
Create a new 1D tensor using '0' as value for each element.
|
Full Usage:
dfx.zeroLike (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
|
Returns the '0' scalar tensor with characteristics based on the input tensor.
|
Full Usage:
dfx.zeros (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 filled with '0' values for the given length, element type and configuration
|
Full Usage:
dfx.zeros (shape, ?device, ?dtype, ?backend)
Parameters:
int seq
-
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 tensor filled with '0' values for the given shape, element type and configuration
|
Full Usage:
dfx.zerosLike (input, ?shape, ?device, ?dtype, ?backend)
Parameters:
Tensor
-
The shape and characteristics of input will determine those of the output tensor.
?shape : int seq
-
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 '0' values with characteristics based on the input tensor.
|
© Copyright 2021, DiffSharp and dfx Contributors.