DML_ACTIVATION_SOFTMAX1_OPERATOR_DESC structure (directml.h)
Performs a softmax activation function on InputTensor, placing the result into the corresponding element of OutputTensor.
For 1-D InputTensor:
// Let x[i] to be the current element in the InputTensor, and j be the total number of elements in the InputTensor
f(x[i]) = exp(x[i]) / sum(exp(x[0]), ..., exp(x[j-1]))
Where exp(x) is the natural exponentiation function.
Important
This API is available as part of the DirectML standalone redistributable package (see Microsoft.AI.DirectML version 1.9 and later. Also see DirectML version history.
Syntax
struct DML_ACTIVATION_SOFTMAX1_OPERATOR_DESC
{
const DML_TENSOR_DESC* InputTensor;
const DML_TENSOR_DESC* OutputTensor;
UINT AxisCount;
_Field_size_(AxisCount) const UINT* Axes;
};
Members
InputTensor
Type: const DML_TENSOR_DESC*
The input tensor to read from.
OutputTensor
Type: const DML_TENSOR_DESC*
The output tensor to write the results to.
AxisCount
Type: UINT
The number of axes to calculate reduce sum. This field determines the size of the Axes array.
Axes
Type: _Field_size_(AxisCount) const UINT*
The axes along which to reduce the sum. Values must be in the range [0, InputTensor.DimensionCount - 1]
.
Remarks
This operator is equivalent to DML_ACTIVATION_SOFTMAX_OPERATOR_DESC when AxisCount == 1, and Axes == {DimensionCount - 1}
.
Availability
This operator was introduced in DML_FEATURE_LEVEL_5_1.
Tensor constraints
InputTensor and OutputTensor must have the same DataType, DimensionCount, and Sizes.
Tensor support
Tensor | Kind | Supported dimension counts | Supported data types |
---|---|---|---|
InputTensor | Input | 1 to 8 | FLOAT32, FLOAT16 |
OutputTensor | Output | 1 to 8 | FLOAT32, FLOAT16 |
Requirements
Header | directml.h |