-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename function and add tests for SoftmaxCrossEntropyLoss
Renamed `impl_softmax_cross_entropy` to `onnx_softmax_crossentropy_loss` in `softmax_crossentropy_loss.cpp` and updated all function calls accordingly. Updated `ONNX_OP` macro for `SoftmaxCrossEntropyLoss` in `opset_13` to use `OPSET_SINCE(13)`. Added new test cases in `onnx_import.in.cpp` for various scenarios of the `SoftmaxCrossEntropyLoss` operation: - `onnx_model_softmax_crossentropy_loss_mean_weight_ii` - `onnx_model_softmax_crossentropy_loss_sum` - `onnx_model_softmax_crossentropy_loss_none` - `onnx_model_softmax_crossentropy_loss_higher_dim` Included new ONNX model files in `prototxt` format for the new test cases: - `softmax_crossentropy_loss_higher_dim.prototxt` - `softmax_crossentropy_loss_mean_weight_ii.prototxt` - `softmax_crossentropy_loss_none.prototxt` - `softmax_crossentropy_loss_sum.prototxt` These files define the graph structure, input/output tensor shapes, and attributes for the `SoftmaxCrossEntropyLoss` operation with different reduction methods and configurations.
- Loading branch information
1 parent
187fed8
commit bdedc9e
Showing
6 changed files
with
280 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/frontends/onnx/tests/models/softmax_crossentropy_loss_higher_dim.prototxt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
ir_version: 7 | ||
producer_name: "OpenVINO ONNX Frontend" | ||
graph { | ||
node { | ||
input: "x" | ||
input: "y" | ||
output: "z" | ||
op_type: "SoftmaxCrossEntropyLoss" | ||
attribute { | ||
name: "reduction" | ||
s: "mean" | ||
type: STRING | ||
} | ||
} | ||
name: "test_sce_higher_dim" | ||
input { | ||
name: "x" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape { | ||
dim { dim_value: 2 } | ||
dim { dim_value: 3 } | ||
dim { dim_value: 2 } | ||
dim { dim_value: 2 } | ||
} | ||
} | ||
} | ||
} | ||
input { | ||
name: "y" | ||
type { | ||
tensor_type { | ||
elem_type: 7 | ||
shape { | ||
dim { dim_value: 2 } | ||
dim { dim_value: 2 } | ||
dim { dim_value: 2 } | ||
} | ||
} | ||
} | ||
} | ||
output { | ||
name: "z" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape {} | ||
} | ||
} | ||
} | ||
} | ||
opset_import { | ||
version: 13 | ||
} |
70 changes: 70 additions & 0 deletions
70
src/frontends/onnx/tests/models/softmax_crossentropy_loss_mean_weight_ii.prototxt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
ir_version: 7 | ||
producer_name: "OpenVINO ONNX Frontend" | ||
graph { | ||
node { | ||
input: "x" | ||
input: "y" | ||
input: "w" | ||
output: "z" | ||
op_type: "SoftmaxCrossEntropyLoss" | ||
attribute { | ||
name: "reduction" | ||
s: "mean" | ||
type: STRING | ||
} | ||
attribute { | ||
name: "ignore_index" | ||
i: -1 | ||
type: INT | ||
} | ||
} | ||
name: "test_sce_mean_weight_ii" | ||
input { | ||
name: "x" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape { | ||
dim { dim_value: 2 } | ||
dim { dim_value: 3 } | ||
dim { dim_value: 2 } | ||
} | ||
} | ||
} | ||
} | ||
input { | ||
name: "y" | ||
type { | ||
tensor_type { | ||
elem_type: 7 | ||
shape { | ||
dim { dim_value: 2 } | ||
dim { dim_value: 2 } | ||
} | ||
} | ||
} | ||
} | ||
input { | ||
name: "w" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape { | ||
dim { dim_value: 3 } | ||
} | ||
} | ||
} | ||
} | ||
output { | ||
name: "z" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape {} | ||
} | ||
} | ||
} | ||
} | ||
opset_import { | ||
version: 13 | ||
} |
53 changes: 53 additions & 0 deletions
53
src/frontends/onnx/tests/models/softmax_crossentropy_loss_none.prototxt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
ir_version: 7 | ||
producer_name: "OpenVINO ONNX Frontend" | ||
graph { | ||
node { | ||
input: "x" | ||
input: "y" | ||
output: "z" | ||
op_type: "SoftmaxCrossEntropyLoss" | ||
attribute { | ||
name: "reduction" | ||
s: "none" | ||
type: STRING | ||
} | ||
} | ||
name: "test_sce_none" | ||
input { | ||
name: "x" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape { | ||
dim { dim_value: 2 } | ||
dim { dim_value: 3 } | ||
} | ||
} | ||
} | ||
} | ||
input { | ||
name: "y" | ||
type { | ||
tensor_type { | ||
elem_type: 7 | ||
shape { | ||
dim { dim_value: 2 } | ||
} | ||
} | ||
} | ||
} | ||
output { | ||
name: "z" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape { | ||
dim { dim_value: 2 } | ||
} | ||
} | ||
} | ||
} | ||
} | ||
opset_import { | ||
version: 13 | ||
} |
51 changes: 51 additions & 0 deletions
51
src/frontends/onnx/tests/models/softmax_crossentropy_loss_sum.prototxt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
ir_version: 7 | ||
producer_name: "OpenVINO ONNX Frontend" | ||
graph { | ||
node { | ||
input: "x" | ||
input: "y" | ||
output: "z" | ||
op_type: "SoftmaxCrossEntropyLoss" | ||
attribute { | ||
name: "reduction" | ||
s: "sum" | ||
type: STRING | ||
} | ||
} | ||
name: "test_sce_sum" | ||
input { | ||
name: "x" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape { | ||
dim { dim_value: 2 } | ||
dim { dim_value: 3 } | ||
} | ||
} | ||
} | ||
} | ||
input { | ||
name: "y" | ||
type { | ||
tensor_type { | ||
elem_type: 7 | ||
shape { | ||
dim { dim_value: 2 } | ||
} | ||
} | ||
} | ||
} | ||
output { | ||
name: "z" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape {} | ||
} | ||
} | ||
} | ||
} | ||
opset_import { | ||
version: 13 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters