InputTensor의 각 요소에 대해 자연스러운 softmax 로그 활성화 함수를 수행하여 결과를 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]) = ln(exp(x[i]) / sum(exp(x[0]), ..., exp(x[j-1])))
여기서 exp(x)는 자연 지수 함수이고 ln(x)은 자연 로그입니다.
중요합니다
이 API는 DirectML 독립 실행형 재배포 가능 패키지의 일부로 사용할 수 있습니다( Microsoft.AI.DirectML 버전 1.9 이상 참조). 또한 DirectML 버전 기록 참조하세요.
문법
struct DML_ACTIVATION_LOG_SOFTMAX1_OPERATOR_DESC
{
const DML_TENSOR_DESC* InputTensor;
const DML_TENSOR_DESC* OutputTensor;
UINT AxisCount;
_Field_size_(AxisCount) const UINT* Axes;
};
구성원
InputTensor
형식: const DML_TENSOR_DESC*
읽을 입력 텐서입니다.
OutputTensor
형식: const DML_TENSOR_DESC*
결과를 쓸 출력 텐서입니다.
AxisCount
형식: UINT
합계를 줄일 축의 수입니다. 이 필드는 축 배열의 크기를 결정 합니다 .
Axes
형식: _Field_size_(AxisCount) const UINT*
합계를 줄일 축입니다. 값은 범위에 [0, InputTensor.DimensionCount - 1]있어야 합니다.
예시
다음 예제에서는 모두 동일한 3차원 입력 텐서를 사용합니다.
InputTensor: (Sizes:{2, 2, 2}, DataType:FLOAT32)
[
[
[ 12, 0],
[-101, 11],
],
[
[ 3, 234],
[ 0, -101],
]
]
예제 1
AxisCount: 1
Axes: {1}
OutputTensor: (Sizes:{2, 2, 2}, DataType:FLOAT32)
[
[ // max element in {12, -101} is 12 and in {0, 11} is 11
[1, 0],
[0, 1],
],
[ // max element in {3, 0} is 3 and in {234, -101} is 234
[1, 1],
[0, 0],
]
]
예제 2
AxisCount: 1
Axes: {0}
OutputTensor: (Sizes:{2, 2, 2}, DataType:FLOAT32)
[
[ // max element in {12, 3} is 12, in {0, 234} is 234, in {-101, 0} is 0 and in {11, -101} is 11
[1, 0],
[0, 1],
],
[
[0, 1],
[1, 0],
]
]
예제 3
AxisCount: 2
Axes: {0, 2}
OutputTensor: (Sizes:{2, 2, 2}, DataType:FLOAT32)
[
[ // max element in {12, 0, 3, 234} is 234 and in {-101, 11, 0, -101} is 11
[0, 0],
[0, 1],
],
[
[0, 1],
[0, 0],
]
]
비고
이 연산자는 AxisCount == 1 및 축 == 의 {DimensionCount - 1} 동일합니다.
가용도
이 연산자는 DML_FEATURE_LEVEL_5_1 도입되었습니다.
Tensor 제약 조건
InputTensor 및 OutputTensor 에는 동일한 DataType, DimensionCount 및 크기가 있어야 합니다.
Tensor 지원
| 텐서 | 친절한 | 지원되는 차원 수 | 지원되는 데이터 형식 |
|---|---|---|---|
| 입력 텐서 | 입력 | 1~8 | FLOAT32, FLOAT16 |
| 출력텐서 | 출력 | 1~8 | FLOAT32, FLOAT16 |
요구 사항
| 머리글 | directml.h |