1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Merge pull request #27809 from abhishek-gola:softmax_cross_entropy

Added support for SCE and NLL losses #27809

This pull request adds the support for Negative Log-Likelihood loss and Softmax Cross-Entropy loss in new DNN engine.

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Abhishek Gola
2025-10-11 15:15:17 +05:30
committed by GitHub
parent f79f193a10
commit 91768f9a27
8 changed files with 889 additions and 202 deletions
@@ -1311,6 +1311,33 @@ CV__DNN_INLINE_NS_BEGIN
static Ptr<Resize2Layer> create(const LayerParams& params);
};
// Shared reduction enum for DNN loss layers
enum LossReduction
{
LOSS_REDUCTION_NONE = 0,
LOSS_REDUCTION_MEAN = 1,
LOSS_REDUCTION_SUM = 2
};
class CV_EXPORTS NegativeLogLikelihoodLossLayer : public Layer
{
public:
LossReduction reduction;
int ignoreIndex;
static Ptr<NegativeLogLikelihoodLossLayer> create(const LayerParams& params);
};
class CV_EXPORTS SoftmaxCrossEntropyLossLayer : public Layer
{
public:
static Ptr<SoftmaxCrossEntropyLossLayer> create(const LayerParams& params);
LossReduction reduction;
int ignoreIndex;
float labelSmoothing;
bool softLabel;
};
/**
* @brief Bilinear resize layer from https://github.com/cdmh/deeplab-public-ver2
*
+2
View File
@@ -119,6 +119,8 @@ void initializeLayerFactory()
CV_DNN_REGISTER_LAYER_CLASS(BitShift, BitShiftLayer);
CV_DNN_REGISTER_LAYER_CLASS(GridSample, GridSampleLayer);
CV_DNN_REGISTER_LAYER_CLASS(Reduce2, Reduce2Layer);
CV_DNN_REGISTER_LAYER_CLASS(NegativeLogLikelihoodLoss, NegativeLogLikelihoodLossLayer);
CV_DNN_REGISTER_LAYER_CLASS(SoftmaxCrossEntropyLoss, SoftmaxCrossEntropyLossLayer);
CV_DNN_REGISTER_LAYER_CLASS(Convolution, ConvolutionLayer);
CV_DNN_REGISTER_LAYER_CLASS(Deconvolution, DeconvolutionLayer);
+238
View File
@@ -0,0 +1,238 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
// Copyright (C) 2025, BigVision LLC, all rights reserved.
// Third party copyrights are property of their respective owners.
#include "../precomp.hpp"
#include "layers_common.hpp"
#include <opencv2/dnn/shape_utils.hpp>
// ONNX operator: NegativeLogLikelihoodLoss
// Spec: https://onnx.ai/onnx/operators/onnx__NegativeLogLikelihoodLoss.html
// Supported opsets: 12-23
namespace cv {
namespace dnn {
class NegativeLogLikelihoodLossImpl CV_FINAL : public NegativeLogLikelihoodLossLayer
{
public:
NegativeLogLikelihoodLossImpl(const LayerParams& params)
{
setParamsFrom(params);
String red = toLowerCase(params.get<String>("reduction", "mean"));
if (red == "none") reduction = LOSS_REDUCTION_NONE;
else if (red == "mean") reduction = LOSS_REDUCTION_MEAN;
else if (red == "sum") reduction = LOSS_REDUCTION_SUM;
else CV_Error(Error::StsBadArg, "Unsupported reduction: " + red);
ignoreIndex = params.get<int>("ignore_index", -1);
}
virtual bool supportBackend(int backendId) CV_OVERRIDE
{
return backendId == DNN_BACKEND_OPENCV;
}
bool getMemoryShapes(const std::vector<MatShape>& in, const int reqOut,
std::vector<MatShape>& out, std::vector<MatShape>& internals) const CV_OVERRIDE
{
CV_Assert(in.size() >= 2);
const MatShape& x = in[0];
CV_Assert(x.size() >= 2);
if (reduction == LOSS_REDUCTION_NONE)
{
MatShape shp = x;
MatShape y; y.reserve(shp.size()-1);
y.push_back(shp[0]);
for (size_t i = 2; i < shp.size(); ++i) {
y.push_back(shp[i]);
}
out.assign(1, y);
}
else
{
out.assign(1, MatShape(1, 1));
}
return false;
}
void getTypes(const std::vector<MatType>&, const int reqOut, const int reqInt,
std::vector<MatType>& out, std::vector<MatType>& internals) const CV_OVERRIDE
{
out.assign(1, MatType(CV_32F));
internals.assign(reqInt, MatType(CV_32F));
}
void forward(InputArrayOfArrays in_arr, OutputArrayOfArrays out_arr, OutputArrayOfArrays) CV_OVERRIDE
{
std::vector<Mat> inp;
in_arr.getMatVector(inp);
const Mat& logp = inp[0];
const Mat& label = inp[1];
const bool hasWeight = inp.size() >= 3;
CV_Assert(logp.dims >= 2);
const int N = logp.size[0], C = logp.size[1];
int S = 1; for (int i = 2; i < logp.dims; ++i) S *= logp.size[i];
MatShape lossShape;
bool isReduced = (reduction != LOSS_REDUCTION_NONE);
if (!isReduced) {
lossShape.push_back(N);
for (int i = 2; i < logp.dims; ++i) {
lossShape.push_back(logp.size[i]);
}
}
auto kind = out_arr.kind();
Mat out_loss;
if (kind == _InputArray::STD_VECTOR_MAT) {
std::vector<Mat>& outs = out_arr.getMatVecRef();
CV_Assert(outs.size() == 1);
if (!isReduced) {
outs[0].fit(lossShape, CV_32F);
}
out_loss = outs[0];
} else if (kind == _InputArray::STD_VECTOR_UMAT) {
std::vector<UMat>& uouts = out_arr.getUMatVecRef();
CV_Assert(uouts.size() == 1);
if (!isReduced) {
uouts[0].fit(lossShape, CV_32F);
}
out_loss = uouts[0].getMat(ACCESS_WRITE);
} else {
CV_Error(cv::Error::StsBadArg, cv::format("Unsupported output array kind: %d", kind));
}
CV_Assert(out_loss.type() == CV_32F);
if (isReduced) {
CV_Assert(out_loss.total() == 1);
}
Mat w_f;
if (hasWeight) {
Mat wsrc = inp[2];
CV_Assert(wsrc.total() == (size_t)C);
Mat wflat = wsrc.reshape(1, (int)wsrc.total()).clone();
wflat.convertTo(w_f, CV_32F);
}
const float* wfDataPtr = hasWeight ? w_f.ptr<float>() : nullptr;
const int nstripes = 16;
Mat logp32; logp.convertTo(logp32, CV_32F);
const size_t sN = logp32.step1(0);
const size_t sC = logp32.step1(1);
CV_Assert(label.depth() == CV_32S || label.depth() == CV_64S);
CV_Assert((int)label.total() == N*S);
Mat idx1D = label.reshape(1, N*S);
Mat per(N*S, 1, CV_32F, Scalar(0));
Mat validMask(N*S, 1, CV_8U, Scalar(1));
Mat effW(N*S, 1, CV_32F, Scalar(1));
if (label.depth() == CV_32S)
{
reduceNLLPerSample<int32_t>(logp32, sN, sC, S, idx1D, C, ignoreIndex, hasWeight, wfDataPtr, per, effW, validMask, nstripes);
}
else
{
reduceNLLPerSample<int64_t>(logp32, sN, sC, S, idx1D, C, ignoreIndex, hasWeight, wfDataPtr, per, effW, validMask, nstripes);
}
if (!isReduced)
{
per.reshape(1, out_loss.size).copyTo(out_loss);
}
else
{
double num = 0.0, den = 0.0;
const float* perData = per.ptr<float>();
const float* effData = effW.ptr<float>();
const uchar* validData = validMask.ptr<uchar>();
const int R = per.rows;
for (int r = 0; r < R; ++r) {
const float m = validData[r] ? 1.f : 0.f;
num += static_cast<double>(perData[r] * m);
if (reduction == LOSS_REDUCTION_MEAN)
{
den += static_cast<double>(std::max(1e-12f, effData[r]) * m);
}
}
const float out = (reduction == LOSS_REDUCTION_SUM) ? static_cast<float>(num) : static_cast<float>((den > 0.0) ? (num / den) : 0.0);
out_loss.at<float>(0) = out;
}
}
private:
template<typename T>
static inline void reduceNLLPerSample(const Mat& logp32,
const size_t sN_,
const size_t sC_,
const int S_,
const Mat& idx1D,
const int C_,
const int ignoreIndex_,
const bool hasWeight_,
const float* wfData_,
Mat& per,
Mat& effW,
Mat& validMask,
const int nstripes)
{
CV_Assert(idx1D.cols == 1);
parallel_for_(Range(0, idx1D.rows), [&](const Range& rr){
const float* base = logp32.ptr<float>();
const T* idx1DData = idx1D.ptr<T>();
uchar* validMaskData = validMask.ptr<uchar>();
float* effWData = effW.ptr<float>();
float* perData = per.ptr<float>();
const size_t sIdx = idx1D.step1(0);
const size_t sVM = validMask.step1(0);
const size_t sEff = effW.step1(0);
const size_t sPer = per.step1(0);
const size_t sN = sN_;
const size_t sC = sC_;
const int S = S_;
const int C = C_;
const int ignoreIndex = ignoreIndex_;
const bool hasWeight = hasWeight_;
const float* wfData = wfData_;
for (int r = rr.start; r < rr.end; ++r)
{
const T y_raw = idx1DData[r * sIdx];
if ((int64_t)y_raw == (int64_t)ignoreIndex)
{
validMaskData[r * sVM] = 0;
effWData[r * sEff] = 0.f;
continue;
}
const int64_t yi64 = (int64_t)y_raw;
CV_Assert(yi64 >= 0 && yi64 < (int64_t)C);
const int y = static_cast<int>(yi64);
const int n = r / S;
const int s = r % S;
const float lp = base[n * sN + y * sC + s];
const float cw = hasWeight ? wfData[y] : 1.f;
perData[r * sPer] = -lp * cw;
effWData[r * sEff] = cw;
}
}, nstripes);
}
};
Ptr<NegativeLogLikelihoodLossLayer> NegativeLogLikelihoodLossLayer::create(const LayerParams& params)
{
return Ptr<NegativeLogLikelihoodLossLayer>(new NegativeLogLikelihoodLossImpl(params));
}
}}
@@ -0,0 +1,402 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
// Copyright (C) 2025, BigVision LLC, all rights reserved.
// Third party copyrights are property of their respective owners.
#include "../precomp.hpp"
#include "layers_common.hpp"
#include <opencv2/dnn/shape_utils.hpp>
#include "cpu_kernels/softmax.hpp"
// ONNX operator: SoftmaxCrossEntropyLoss
// Spec: https://onnx.ai/onnx/operators/onnx__SoftmaxCrossEntropyLoss.html
// Supported opsets: 12-23
namespace cv {
namespace dnn {
class SoftmaxCrossEntropyLossImpl CV_FINAL : public SoftmaxCrossEntropyLossLayer
{
public:
SoftmaxCrossEntropyLossImpl(const LayerParams& params)
{
setParamsFrom(params);
String red = toLowerCase(params.get<String>("reduction", "mean"));
if (red == "none") reduction = LOSS_REDUCTION_NONE;
else if (red == "mean") reduction = LOSS_REDUCTION_MEAN;
else if (red == "sum") reduction = LOSS_REDUCTION_SUM;
else CV_Error(Error::StsBadArg, "Unsupported reduction: " + red);
ignoreIndex = params.get<int>("ignore_index", -1);
labelSmoothing = params.get<float>("label_smoothing", 0.f);
softLabel = params.get<int>("soft_label", 0) != 0;
}
virtual bool supportBackend(int backendId) CV_OVERRIDE
{
return backendId == DNN_BACKEND_OPENCV;
}
bool getMemoryShapes(const std::vector<MatShape>& in, const int requiredOutputs,
std::vector<MatShape>& out, std::vector<MatShape>& internals) const CV_OVERRIDE
{
CV_Assert(in.size() >= 2);
const MatShape& x = in[0];
CV_Assert(x.size() >= 2);
if (reduction == LOSS_REDUCTION_NONE) {
MatShape y; y.push_back(x[0]);
for (size_t i = 2; i < x.size(); ++i) y.push_back(x[i]);
out.push_back(y);
} else {
out.push_back(MatShape(1,1));
}
if (requiredOutputs >= 2)
out.push_back(x);
return false;
}
void getTypes(const std::vector<MatType>&, const int requiredOutputs, const int,
std::vector<MatType>& out, std::vector<MatType>&) const CV_OVERRIDE
{
out.clear();
out.push_back(CV_32F);
if (requiredOutputs >= 2) out.push_back(CV_32F);
}
void forward(InputArrayOfArrays in_arr, OutputArrayOfArrays out_arr, OutputArrayOfArrays) CV_OVERRIDE
{
std::vector<Mat> inp;
in_arr.getMatVector(inp);
const Mat& logits = inp[0];
const Mat& labels = inp[1];
const bool hasWeight = inp.size() >= 3;
const Mat& w = hasWeight ? inp[2] : Mat();
CV_Assert(logits.dims >= 2);
const int N = logits.size[0], C = logits.size[1];
int S = 1; for (int i = 2; i < logits.dims; ++i) S *= logits.size[i];
MatShape logitsShape = shape(logits);
MatShape lossShape;
bool isReduced = (reduction != LOSS_REDUCTION_NONE);
if (!isReduced) {
lossShape.push_back(N);
for (int i = 2; i < logits.dims; ++i) lossShape.push_back(logits.size[i]);
}
auto kind = out_arr.kind();
Mat out_loss, out_logprob;
bool wantLogProb = false;
if (kind == _InputArray::STD_VECTOR_MAT) {
std::vector<Mat>& outs = out_arr.getMatVecRef();
CV_Assert(outs.size() == 1 || outs.size() == 2);
wantLogProb = (outs.size() == 2);
if (!isReduced) {
outs[0].fit(lossShape, CV_32F);
}
out_loss = outs[0];
if (wantLogProb) {
outs[1].fit(logitsShape, CV_32F);
out_logprob = outs[1];
}
} else if (kind == _InputArray::STD_VECTOR_UMAT) {
std::vector<UMat>& uouts = out_arr.getUMatVecRef();
CV_Assert(uouts.size() == 1 || uouts.size() == 2);
wantLogProb = (uouts.size() == 2);
if (!isReduced) {
uouts[0].fit(lossShape, CV_32F);
}
out_loss = uouts[0].getMat(ACCESS_WRITE);
if (wantLogProb) {
uouts[1].fit(logitsShape, CV_32F);
out_logprob = uouts[1].getMat(ACCESS_WRITE);
}
} else {
CV_Error(cv::Error::StsBadArg, cv::format("Unsupported output array kind: %d", kind));
}
CV_Assert(out_loss.type() == CV_32F);
if (isReduced) {
CV_Assert(out_loss.total() == 1);
}
const int nstripes = 16;
Mat logits32; logits.convertTo(logits32, CV_32F);
const size_t sN = logits32.step1(0);
const size_t sC = logits32.step1(1);
std::vector<float> rowLogSumExp(N*S);
std::vector<float> meanLogRow(N*S);
bool writeLogProb = (wantLogProb);
size_t sN_out = 0, sC_out = 0;
float* outlpBase = nullptr;
if (writeLogProb) {
CV_Assert(out_logprob.type() == CV_32F);
sN_out = out_logprob.step1(0);
sC_out = out_logprob.step1(1);
outlpBase = out_logprob.ptr<float>();
}
parallel_for_(Range(0, N*S), [&](const Range& rr){
const float* base = logits32.ptr<float>();
float* rowLSE = rowLogSumExp.data();
float* meanLR = meanLogRow.data();
const size_t sN_ = sN;
const size_t sC_ = sC;
const int S_ = S;
const int C_ = C;
const bool writeLP = writeLogProb;
float* outlpPtr = outlpBase;
const size_t sN_out_ = sN_out;
const size_t sC_out_ = sC_out;
AutoBuffer<float> tempBuf_(C_);
float* tempbuf = tempBuf_.data();
for (int r = rr.start; r < rr.end; ++r) {
const int n = r / S_;
const int s = r % S_;
const float* rowBase = base + n * sN_ + s;
float maxv = -FLT_MAX;
int c = 0;
#if CV_ENABLE_UNROLLED && defined(_M_ARM64)
for (; c + 3 < C_; c += 4) {
const float v0 = rowBase[(c + 0) * sC_];
const float v1 = rowBase[(c + 1) * sC_];
const float v2 = rowBase[(c + 2) * sC_];
const float v3 = rowBase[(c + 3) * sC_];
tempbuf[c + 0] = v0;
tempbuf[c + 1] = v1;
tempbuf[c + 2] = v2;
tempbuf[c + 3] = v3;
maxv = std::max(maxv, std::max(std::max(v0, v1), std::max(v2, v3)));
}
#endif
for (; c < C_; ++c) {
const float v = rowBase[c * sC_];
tempbuf[c] = v;
maxv = std::max(maxv, v);
}
float sumExp = 0.f;
float sumLogits = 0.f;
int i = 0;
#if (CV_SIMD || CV_SIMD_SCALABLE)
const int nlanes = VTraits<v_float32>::vlanes();
v_float32 vsExp = vx_setzero_f32();
v_float32 vsLog = vx_setzero_f32();
v_float32 vmaxv = vx_setall_f32(maxv);
for (; i <= C_ - nlanes; i += nlanes) {
v_float32 v = vx_load(tempbuf + i);
vsLog = v_add(vsLog, v);
v_float32 vshift = v_sub(v, vmaxv);
v_float32 ev = v_exp(vshift);
vsExp = v_add(vsExp, ev);
}
sumExp += v_reduce_sum(vsExp);
sumLogits += v_reduce_sum(vsLog);
#endif
for (; i < C_; ++i) {
const float v = tempbuf[i];
sumLogits += v;
sumExp += expf(v - maxv);
}
const float lse = logf(sumExp) + maxv;
rowLSE[r] = lse;
meanLR[r] = sumLogits / static_cast<float>(C_) - lse;
if (writeLP && outlpPtr) {
float* dst = outlpPtr + n * sN_out_ + s;
for (int c = 0; c < C_; ++c) dst[c * sC_out_] = tempbuf[c] - lse;
}
}
}, nstripes);
const bool expanded = (labels.dims == logits.dims && labels.size[1] == C) || softLabel;
const float eps = std::max(0.f, std::min(1.f, labelSmoothing));
Mat per(N*S, 1, CV_32F, Scalar(0));
Mat validMask(N*S, 1, CV_8U, Scalar(1));
Mat effW(N*S, 1, CV_32F, Scalar(1));
if (!expanded)
{
CV_Assert(labels.depth() == CV_32S || labels.depth() == CV_64S);
CV_Assert((int)labels.total() == N*S);
Mat idx1D = labels.reshape(1, N*S);
const float* wptr = hasWeight ? w.ptr<float>() : nullptr;
if (labels.depth() == CV_32S)
{
if (hasWeight)
reduceSCEPerSample<int32_t, true>(logits32, sN, sC, S, idx1D, C, ignoreIndex, eps, meanLogRow.data(), rowLogSumExp.data(), wptr, per, effW, validMask, nstripes);
else
reduceSCEPerSample<int32_t, false>(logits32, sN, sC, S, idx1D, C, ignoreIndex, eps, meanLogRow.data(), rowLogSumExp.data(), wptr, per, effW, validMask, nstripes);
}
else
{
if (hasWeight)
reduceSCEPerSample<int64_t, true>(logits32, sN, sC, S, idx1D, C, ignoreIndex, eps, meanLogRow.data(), rowLogSumExp.data(), wptr, per, effW, validMask, nstripes);
else
reduceSCEPerSample<int64_t, false>(logits32, sN, sC, S, idx1D, C, ignoreIndex, eps, meanLogRow.data(), rowLogSumExp.data(), wptr, per, effW, validMask, nstripes);
}
}
else
{
Mat labels32; labels.convertTo(labels32, CV_32F);
const size_t sN_lab = labels32.step1(0);
const size_t sC_lab = labels32.step1(1);
const float smoothMul = (!softLabel && eps > 0.f) ? (1.f - eps) : 1.f;
const float smoothAdd = (!softLabel && eps > 0.f) ? (eps / C) : 0.f;
std::vector<float> onesW;
const float* wBase = nullptr;
if (hasWeight){
wBase = w.ptr<float>();
} else {
onesW.assign(C, 1.f);
wBase = onesW.data();
}
parallel_for_(Range(0, N*S), [&](const Range& rr){
const float* baseLogits = logits32.ptr<float>();
const float* baseLabels = labels32.ptr<float>();
const float* wData = wBase;
float* perData = per.ptr<float>();
float* effWData = effW.ptr<float>();
uchar* validMaskData = validMask.ptr<uchar>();
float* rowLSE = rowLogSumExp.data();
const size_t sN_ = sN;
const size_t sC_ = sC;
const size_t sN_lab_ = sN_lab;
const size_t sC_lab_ = sC_lab;
const int S_ = S;
const int C_ = C;
const float smoothMul_ = smoothMul;
const float smoothAdd_ = smoothAdd;
const size_t sPer = per.step1(0);
const size_t sEff = effW.step1(0);
const size_t sVM = validMask.step1(0);
for (int r = rr.start; r < rr.end; ++r) {
const int n = r / S_;
const int s = r % S_;
const float* arow = baseLabels + n * sN_lab_ + s;
const float* lrow = baseLogits + n * sN_ + s;
double dot = 0.0, wsum = 0.0;
for (int c = 0; c < C_; ++c) {
float a = arow[c * sC_lab_] * smoothMul_ + smoothAdd_;
a *= wData[c];
wsum += static_cast<double>(a);
dot += static_cast<double>(a) * static_cast<double>(lrow[c * sC_]);
}
const float m = (wsum != 0.0) ? 1.f : 0.f;
validMaskData[r * sVM] = static_cast<uchar>(m > 0.f);
effWData[r * sEff] = static_cast<float>(wsum * m);
perData[r * sPer] = static_cast<float>(-(dot - static_cast<double>(rowLSE[r]) * wsum) * m);
}
}, nstripes);
}
if (!isReduced)
{
per.reshape(1, out_loss.size).copyTo(out_loss);
}
else
{
double num = 0.0, den = 0.0;
const float* perData = per.ptr<float>();
const float* effData = effW.ptr<float>();
const uchar* validData = validMask.ptr<uchar>();
const int R = per.rows;
for (int r = 0; r < R; ++r) {
const float m = validData[r] ? 1.f : 0.f;
num += static_cast<double>(perData[r] * m);
if (reduction == LOSS_REDUCTION_MEAN)
{
den += static_cast<double>(std::max(1e-12f, effData[r]) * m);
}
}
const float out = (reduction == LOSS_REDUCTION_SUM) ? static_cast<float>(num)
: static_cast<float>((den > 0.0) ? (num / den) : 0.0);
out_loss.at<float>(0) = out;
}
}
private:
template<typename T, bool UseWeight>
static inline void reduceSCEPerSample(const Mat& logits32,
const size_t sN_,
const size_t sC_,
const int S_,
const Mat& idx1D,
const int C_,
const int ignoreIndex,
const float eps,
const float* meanLogRowData,
const float* rowLogSumExp,
const float* weightBase,
Mat& per,
Mat& effW,
Mat& validMask,
const int nstripes)
{
CV_Assert(idx1D.cols == 1);
parallel_for_(Range(0, idx1D.rows), [&](const Range& rr){
const float* base = logits32.ptr<float>();
const T* idx1DData = idx1D.ptr<T>();
uchar* validMaskData = validMask.ptr<uchar>();
float* effWData = effW.ptr<float>();
float* perData = per.ptr<float>();
const size_t sIdx = idx1D.step1(0);
const size_t sVM = validMask.step1(0);
const size_t sEff = effW.step1(0);
const size_t sPer = per.step1(0);
const size_t sN = sN_;
const size_t sC = sC_;
const int S = S_;
const int C = C_;
for (int r = rr.start; r < rr.end; ++r)
{
const T y_raw = idx1DData[r * sIdx];
if ((int64_t)y_raw == (int64_t)ignoreIndex)
{
validMaskData[r * sVM] = 0;
effWData[r * sEff] = 0.f;
continue;
}
const int64_t yi64 = (int64_t)y_raw;
CV_Assert(yi64 >= 0 && yi64 < (int64_t)C);
const int y = static_cast<int>(yi64);
const int n = r / S;
const int s = r % S;
const float logits_y = base[n * sN + y * sC + s];
const float lp_y = logits_y - rowLogSumExp[r];
const float cw = UseWeight ? weightBase[y] : 1.f;
float loss = -(1.f - eps) * lp_y;
if (eps > 0.f) loss += -eps * meanLogRowData[r];
perData[r * sPer] = loss * cw;
effWData[r * sEff] = cw;
}
}, nstripes);
}
};
Ptr<SoftmaxCrossEntropyLossLayer> SoftmaxCrossEntropyLossLayer::create(const LayerParams& params)
{
return Ptr<SoftmaxCrossEntropyLossLayer>(new SoftmaxCrossEntropyLossImpl(params));
}
}}
+18
View File
@@ -219,6 +219,8 @@ protected:
void parseIsInf (LayerParams& layerParams, const opencv_onnx::NodeProto& node_proto);
void parseDet (LayerParams& layerParams, const opencv_onnx::NodeProto& node_proto);
void parseGridSample (LayerParams& layerParams, const opencv_onnx::NodeProto& node_proto);
void parseNegativeLogLikelihoodLoss(LayerParams& layerParams, const opencv_onnx::NodeProto& node_proto);
void parseSoftmaxCrossEntropyLoss (LayerParams& layerParams, const opencv_onnx::NodeProto& node_proto);
void parseResize (LayerParams& layerParams, const opencv_onnx::NodeProto& node_proto);
void parseSize (LayerParams& layerParams, const opencv_onnx::NodeProto& node_proto);
void parseUnique (LayerParams& layerParams, const opencv_onnx::NodeProto& node_proto);
@@ -1763,6 +1765,20 @@ void ONNXImporter2::parseNonMaxSuprression(LayerParams& layerParams, const openc
addLayer(layerParams, node_proto);
}
void ONNXImporter2::parseNegativeLogLikelihoodLoss(LayerParams& layerParams,
const opencv_onnx::NodeProto& node_proto)
{
layerParams.type = "NegativeLogLikelihoodLoss";
addLayer(layerParams, node_proto);
}
void ONNXImporter2::parseSoftmaxCrossEntropyLoss(LayerParams& layerParams,
const opencv_onnx::NodeProto& node_proto)
{
layerParams.type = "SoftmaxCrossEntropyLoss";
addLayer(layerParams, node_proto);
}
void ONNXImporter2::parseUpsample(LayerParams& layerParams, const opencv_onnx::NodeProto& node_proto)
{
int n_inputs = node_proto.input_size();
@@ -2621,6 +2637,8 @@ void ONNXImporter2::buildDispatchMap_ONNX_AI(int opset_version)
dispatch["Tile"] = &ONNXImporter2::parseTile;
dispatch["LayerNormalization"] = &ONNXImporter2::parseLayerNorm;
dispatch["GroupNormalization"] = &ONNXImporter2::parseInstanceNormalization;
dispatch["NegativeLogLikelihoodLoss"] = &ONNXImporter2::parseNegativeLogLikelihoodLoss;
dispatch["SoftmaxCrossEntropyLoss"] = &ONNXImporter2::parseSoftmaxCrossEntropyLoss;
dispatch["Equal"] = dispatch["Greater"] = dispatch["Less"] = dispatch["Pow"] = dispatch["Add"] =
dispatch["Sub"] = dispatch["Mul"] = dispatch["Div"] = dispatch["GreaterOrEqual"] =
@@ -1528,77 +1528,77 @@ CASE(test_neg_example)
CASE(test_nesterov_momentum)
// no filter
CASE(test_nllloss_NC)
// no filter
SKIP;
CASE(test_nllloss_NC_expanded)
// no filter
SKIP;
CASE(test_nllloss_NCd1)
// no filter
SKIP;
CASE(test_nllloss_NCd1_expanded)
// no filter
SKIP;
CASE(test_nllloss_NCd1_ii)
// no filter
SKIP;
CASE(test_nllloss_NCd1_ii_expanded)
// no filter
SKIP;
CASE(test_nllloss_NCd1_mean_weight_negative_ii)
// no filter
SKIP;
CASE(test_nllloss_NCd1_mean_weight_negative_ii_expanded)
// no filter
SKIP;
CASE(test_nllloss_NCd1_weight)
// no filter
SKIP;
CASE(test_nllloss_NCd1_weight_expanded)
// no filter
SKIP;
CASE(test_nllloss_NCd1_weight_ii)
// no filter
SKIP;
CASE(test_nllloss_NCd1_weight_ii_expanded)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2_expanded)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2_no_weight_reduction_mean_ii)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2_no_weight_reduction_mean_ii_expanded)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2_reduction_mean)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2_reduction_mean_expanded)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2_reduction_sum)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2_reduction_sum_expanded)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2_with_weight)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2_with_weight_expanded)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2_with_weight_reduction_mean)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2_with_weight_reduction_mean_expanded)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2_with_weight_reduction_sum)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2_with_weight_reduction_sum_expanded)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2_with_weight_reduction_sum_ii)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2_with_weight_reduction_sum_ii_expanded)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2d3_none_no_weight_negative_ii)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2d3_none_no_weight_negative_ii_expanded)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2d3_sum_weight_high_ii)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2d3_sum_weight_high_ii_expanded)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2d3d4d5_mean_weight)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2d3d4d5_mean_weight_expanded)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2d3d4d5_none_no_weight)
// no filter
SKIP;
CASE(test_nllloss_NCd1d2d3d4d5_none_no_weight_expanded)
// no filter
SKIP;
CASE(test_nonmaxsuppression_center_point_box_format)
SKIP;
CASE(test_nonmaxsuppression_flipped_coordinates)
@@ -2160,141 +2160,141 @@ CASE(test_scatternd_min)
CASE(test_scatternd_multiply)
// no filter
CASE(test_sce_NCd1_mean_weight_negative_ii)
// no filter
SKIP;
CASE(test_sce_NCd1_mean_weight_negative_ii_expanded)
// no filter
SKIP;
CASE(test_sce_NCd1_mean_weight_negative_ii_log_prob)
// no filter
SKIP;
CASE(test_sce_NCd1_mean_weight_negative_ii_log_prob_expanded)
// no filter
SKIP;
CASE(test_sce_NCd1d2d3_none_no_weight_negative_ii)
// no filter
SKIP;
CASE(test_sce_NCd1d2d3_none_no_weight_negative_ii_expanded)
// no filter
SKIP;
CASE(test_sce_NCd1d2d3_none_no_weight_negative_ii_log_prob)
// no filter
SKIP;
CASE(test_sce_NCd1d2d3_none_no_weight_negative_ii_log_prob_expanded)
// no filter
SKIP;
CASE(test_sce_NCd1d2d3_sum_weight_high_ii)
// no filter
SKIP;
CASE(test_sce_NCd1d2d3_sum_weight_high_ii_expanded)
// no filter
SKIP;
CASE(test_sce_NCd1d2d3_sum_weight_high_ii_log_prob)
// no filter
SKIP;
CASE(test_sce_NCd1d2d3_sum_weight_high_ii_log_prob_expanded)
// no filter
SKIP;
CASE(test_sce_NCd1d2d3d4d5_mean_weight)
// no filter
SKIP;
CASE(test_sce_NCd1d2d3d4d5_mean_weight_expanded)
// no filter
SKIP;
CASE(test_sce_NCd1d2d3d4d5_mean_weight_log_prob)
// no filter
SKIP;
CASE(test_sce_NCd1d2d3d4d5_mean_weight_log_prob_expanded)
// no filter
SKIP;
CASE(test_sce_NCd1d2d3d4d5_none_no_weight)
// no filter
SKIP;
CASE(test_sce_NCd1d2d3d4d5_none_no_weight_expanded)
// no filter
SKIP;
CASE(test_sce_NCd1d2d3d4d5_none_no_weight_log_prob)
// no filter
SKIP;
CASE(test_sce_NCd1d2d3d4d5_none_no_weight_log_prob_expanded)
// no filter
SKIP;
CASE(test_sce_mean)
// no filter
SKIP;
CASE(test_sce_mean_3d)
// no filter
SKIP;
CASE(test_sce_mean_3d_expanded)
// no filter
SKIP;
CASE(test_sce_mean_3d_log_prob)
// no filter
SKIP;
CASE(test_sce_mean_3d_log_prob_expanded)
// no filter
SKIP;
CASE(test_sce_mean_expanded)
// no filter
SKIP;
CASE(test_sce_mean_log_prob)
// no filter
SKIP;
CASE(test_sce_mean_log_prob_expanded)
// no filter
SKIP;
CASE(test_sce_mean_no_weight_ii)
// no filter
SKIP;
CASE(test_sce_mean_no_weight_ii_3d)
// no filter
SKIP;
CASE(test_sce_mean_no_weight_ii_3d_expanded)
// no filter
SKIP;
CASE(test_sce_mean_no_weight_ii_3d_log_prob)
// no filter
SKIP;
CASE(test_sce_mean_no_weight_ii_3d_log_prob_expanded)
// no filter
SKIP;
CASE(test_sce_mean_no_weight_ii_4d)
// no filter
SKIP;
CASE(test_sce_mean_no_weight_ii_4d_expanded)
// no filter
SKIP;
CASE(test_sce_mean_no_weight_ii_4d_log_prob)
// no filter
SKIP;
CASE(test_sce_mean_no_weight_ii_4d_log_prob_expanded)
// no filter
SKIP;
CASE(test_sce_mean_no_weight_ii_expanded)
// no filter
SKIP;
CASE(test_sce_mean_no_weight_ii_log_prob)
// no filter
SKIP;
CASE(test_sce_mean_no_weight_ii_log_prob_expanded)
// no filter
SKIP;
CASE(test_sce_mean_weight)
// no filter
SKIP;
CASE(test_sce_mean_weight_expanded)
// no filter
SKIP;
CASE(test_sce_mean_weight_ii)
// no filter
SKIP;
CASE(test_sce_mean_weight_ii_3d)
// no filter
SKIP;
CASE(test_sce_mean_weight_ii_3d_expanded)
// no filter
SKIP;
CASE(test_sce_mean_weight_ii_3d_log_prob)
// no filter
SKIP;
CASE(test_sce_mean_weight_ii_3d_log_prob_expanded)
// no filter
SKIP;
CASE(test_sce_mean_weight_ii_4d)
// no filter
SKIP;
CASE(test_sce_mean_weight_ii_4d_expanded)
// no filter
SKIP;
CASE(test_sce_mean_weight_ii_4d_log_prob)
// no filter
SKIP;
CASE(test_sce_mean_weight_ii_4d_log_prob_expanded)
// no filter
SKIP;
CASE(test_sce_mean_weight_ii_expanded)
// no filter
SKIP;
CASE(test_sce_mean_weight_ii_log_prob)
// no filter
SKIP;
CASE(test_sce_mean_weight_ii_log_prob_expanded)
// no filter
SKIP;
CASE(test_sce_mean_weight_log_prob)
// no filter
SKIP;
CASE(test_sce_mean_weight_log_prob_expanded)
// no filter
SKIP;
CASE(test_sce_none)
// no filter
SKIP;
CASE(test_sce_none_expanded)
// no filter
SKIP;
CASE(test_sce_none_log_prob)
// no filter
SKIP;
CASE(test_sce_none_log_prob_expanded)
// no filter
SKIP;
CASE(test_sce_none_weights)
// no filter
SKIP;
CASE(test_sce_none_weights_expanded)
// no filter
SKIP;
CASE(test_sce_none_weights_log_prob)
// no filter
SKIP;
CASE(test_sce_none_weights_log_prob_expanded)
// no filter
SKIP;
CASE(test_sce_sum)
// no filter
SKIP;
CASE(test_sce_sum_expanded)
// no filter
SKIP;
CASE(test_sce_sum_log_prob)
// no filter
SKIP;
CASE(test_sce_sum_log_prob_expanded)
// no filter
SKIP;
CASE(test_selu)
// no filter
CASE(test_selu_default)
@@ -457,3 +457,98 @@
"test_leakyrelu_default_expanded",
"test_leakyrelu_example_expanded",
"test_leakyrelu_expanded",
"test_sce_NCd1_mean_weight_negative_ii",
"test_sce_NCd1_mean_weight_negative_ii_expanded",
"test_sce_NCd1_mean_weight_negative_ii_log_prob",
"test_sce_NCd1_mean_weight_negative_ii_log_prob_expanded",
"test_sce_NCd1d2d3_none_no_weight_negative_ii",
"test_sce_NCd1d2d3_none_no_weight_negative_ii_expanded",
"test_sce_NCd1d2d3_none_no_weight_negative_ii_log_prob",
"test_sce_NCd1d2d3_none_no_weight_negative_ii_log_prob_expanded",
"test_sce_NCd1d2d3_sum_weight_high_ii",
"test_sce_NCd1d2d3_sum_weight_high_ii_expanded",
"test_sce_NCd1d2d3_sum_weight_high_ii_log_prob",
"test_sce_NCd1d2d3_sum_weight_high_ii_log_prob_expanded",
"test_sce_NCd1d2d3d4d5_mean_weight",
"test_sce_NCd1d2d3d4d5_mean_weight_expanded",
"test_sce_NCd1d2d3d4d5_mean_weight_log_prob",
"test_sce_NCd1d2d3d4d5_mean_weight_log_prob_expanded",
"test_sce_NCd1d2d3d4d5_none_no_weight",
"test_sce_NCd1d2d3d4d5_none_no_weight_expanded",
"test_sce_NCd1d2d3d4d5_none_no_weight_log_prob",
"test_sce_NCd1d2d3d4d5_none_no_weight_log_prob_expanded",
"test_sce_mean",
"test_sce_mean_3d",
"test_sce_mean_3d_expanded",
"test_sce_mean_3d_log_prob",
"test_sce_mean_3d_log_prob_expanded",
"test_sce_mean_expanded",
"test_sce_mean_log_prob",
"test_sce_mean_log_prob_expanded",
"test_sce_mean_no_weight_ii",
"test_sce_mean_no_weight_ii_3d",
"test_sce_mean_no_weight_ii_3d_expanded",
"test_sce_mean_no_weight_ii_3d_log_prob",
"test_sce_mean_no_weight_ii_3d_log_prob_expanded",
"test_sce_mean_no_weight_ii_4d",
"test_sce_mean_no_weight_ii_4d_expanded",
"test_sce_mean_no_weight_ii_4d_log_prob",
"test_sce_mean_no_weight_ii_4d_log_prob_expanded",
"test_sce_mean_no_weight_ii_expanded",
"test_sce_mean_no_weight_ii_log_prob",
"test_sce_mean_no_weight_ii_log_prob_expanded",
"test_sce_mean_weight",
"test_sce_mean_weight_expanded",
"test_sce_mean_weight_ii",
"test_sce_mean_weight_ii_3d",
"test_sce_mean_weight_ii_3d_expanded",
"test_sce_mean_weight_ii_3d_log_prob",
"test_sce_mean_weight_ii_3d_log_prob_expanded",
"test_sce_mean_weight_ii_4d",
"test_sce_mean_weight_ii_4d_expanded",
"test_sce_mean_weight_ii_4d_log_prob",
"test_sce_mean_weight_ii_4d_log_prob_expanded",
"test_sce_mean_weight_ii_expanded",
"test_sce_mean_weight_ii_log_prob",
"test_sce_mean_weight_ii_log_prob_expanded",
"test_sce_mean_weight_log_prob",
"test_sce_mean_weight_log_prob_expanded",
"test_sce_none",
"test_sce_none_expanded",
"test_sce_none_log_prob",
"test_sce_none_log_prob_expanded",
"test_sce_none_weights",
"test_sce_none_weights_expanded",
"test_sce_none_weights_log_prob",
"test_sce_none_weights_log_prob_expanded",
"test_sce_sum",
"test_sce_sum_expanded",
"test_sce_sum_log_prob",
"test_sce_sum_log_prob_expanded",
"test_nllloss_NC",
"test_nllloss_NCd1",
"test_nllloss_NCd1_ii",
"test_nllloss_NCd1_ii_expanded",
"test_nllloss_NCd1_mean_weight_negative_ii",
"test_nllloss_NCd1_mean_weight_negative_ii_expanded",
"test_nllloss_NCd1_weight",
"test_nllloss_NCd1_weight_ii",
"test_nllloss_NCd1_weight_ii_expanded",
"test_nllloss_NCd1d2",
"test_nllloss_NCd1d2_no_weight_reduction_mean_ii",
"test_nllloss_NCd1d2_no_weight_reduction_mean_ii_expanded",
"test_nllloss_NCd1d2_reduction_mean",
"test_nllloss_NCd1d2_reduction_mean_expanded",
"test_nllloss_NCd1d2_reduction_sum",
"test_nllloss_NCd1d2_with_weight",
"test_nllloss_NCd1d2_with_weight_reduction_mean",
"test_nllloss_NCd1d2_with_weight_reduction_sum",
"test_nllloss_NCd1d2_with_weight_reduction_sum_expanded",
"test_nllloss_NCd1d2_with_weight_reduction_sum_ii",
"test_nllloss_NCd1d2_with_weight_reduction_sum_ii_expanded",
"test_nllloss_NCd1d2d3_none_no_weight_negative_ii",
"test_nllloss_NCd1d2d3_none_no_weight_negative_ii_expanded",
"test_nllloss_NCd1d2d3_sum_weight_high_ii",
"test_nllloss_NCd1d2d3_sum_weight_high_ii_expanded",
"test_nllloss_NCd1d2d3d4d5_mean_weight",
"test_nllloss_NCd1d2d3d4d5_none_no_weight",
@@ -485,35 +485,8 @@
"test_mvn_expanded", // Issues::Wrong answer
"test_mvn_expanded_ver18",
"test_nesterov_momentum", // Issues::Layer does not exist (NesterovsAcceleratedGradient) Can't create layer "onnx_node_output_0!X_new" of type "ai.onnx.preview.training.Momentum" in function 'getLayerInstance'
"test_nllloss_NC", // Issue:: Layer does not exist (NegativeLogLikelihoodLoss, SoftmaxCrossEntropyLoss)
"test_nllloss_NCd1", // Issue:: Layer does not exist (NegativeLogLikelihoodLoss, SoftmaxCrossEntropyLoss)
"test_nllloss_NCd1_ii", // Issue:: Layer does not exist (NegativeLogLikelihoodLoss, SoftmaxCrossEntropyLoss)
"test_nllloss_NCd1_ii_expanded", // Issue:: Unsupported data type
"test_nllloss_NCd1_mean_weight_negative_ii", // Issue:: Layer does not exist (NegativeLogLikelihoodLoss, SoftmaxCrossEntropyLoss)
"test_nllloss_NCd1_mean_weight_negative_ii_expanded", // Issue:: Unsupported data type
"test_nllloss_NCd1_weight", // Issue:: Layer does not exist (NegativeLogLikelihoodLoss, SoftmaxCrossEntropyLoss)
"test_nllloss_NCd1_weight_ii", // Issue:: Unsupported data type
"test_nllloss_NCd1_weight_ii_expanded", // Issue:: Unsupported data type
"test_nllloss_NCd1d2", // Issue:: Layer does not exist (NegativeLogLikelihoodLoss, SoftmaxCrossEntropyLoss)
"test_nllloss_NCd1d2_no_weight_reduction_mean_ii", // Issue:: Unsupported data type
"test_nllloss_NCd1d2_no_weight_reduction_mean_ii_expanded", // Issue:: Unsupported data type
"test_nllloss_NCd1d2_reduction_mean", // Issue:: Layer does not exist (NegativeLogLikelihoodLoss, SoftmaxCrossEntropyLoss)
"test_nllloss_NCd1d2_reduction_mean_expanded", // Issue:: Layer does not exist (NegativeLogLikelihoodLoss, SoftmaxCrossEntropyLoss)
"test_nllloss_NCd1d2_reduction_sum", // Issue:: Layer does not exist (NegativeLogLikelihoodLoss, SoftmaxCrossEntropyLoss)
"test_nllloss_NCd1d2_reduction_sum_expanded", // Issue:: Layer does not exist (NegativeLogLikelihoodLoss, SoftmaxCrossEntropyLoss)
"test_nllloss_NCd1d2_with_weight", // Issue:: Layer does not exist (NegativeLogLikelihoodLoss, SoftmaxCrossEntropyLoss)
"test_nllloss_NCd1d2_with_weight_reduction_mean", // Issue:: Layer does not exist (NegativeLogLikelihoodLoss, SoftmaxCrossEntropyLoss)
"test_nllloss_NCd1d2_with_weight_reduction_sum", // Issue:: Layer does not exist (NegativeLogLikelihoodLoss, SoftmaxCrossEntropyLoss)
"test_nllloss_NCd1d2_with_weight_reduction_sum_expanded", // Issue::Wrong output on CUDA
"test_nllloss_NCd1d2_with_weight_reduction_sum_ii", // Issue:: Layer does not exist (NegativeLogLikelihoodLoss, SoftmaxCrossEntropyLoss)
"test_nllloss_NCd1d2_with_weight_reduction_sum_ii_expanded", // Issue:: Unsupported data type
"test_nllloss_NCd1d2d3_none_no_weight_negative_ii", // Issue:: Layer does not exist (NegativeLogLikelihoodLoss, SoftmaxCrossEntropyLoss)
"test_nllloss_NCd1d2d3_none_no_weight_negative_ii_expanded", // Issue:: Unsupported data type
"test_nllloss_NCd1d2d3_sum_weight_high_ii", // Issue:: Layer does not exist (NegativeLogLikelihoodLoss, SoftmaxCrossEntropyLoss)
"test_nllloss_NCd1d2d3_sum_weight_high_ii_expanded", // Issue:: Unsupported data type
"test_nllloss_NCd1d2d3d4d5_mean_weight", // Issue:: Layer does not exist (NegativeLogLikelihoodLoss, SoftmaxCrossEntropyLoss)
"test_nllloss_NCd1d2d3d4d5_mean_weight_expanded", // Issue::Wrong output
"test_nllloss_NCd1d2d3d4d5_none_no_weight", // Issue:: Layer does not exist (NegativeLogLikelihoodLoss, SoftmaxCrossEntropyLoss)
"test_nllloss_NCd1d2_reduction_sum_expanded",
"test_nllloss_NCd1d2d3d4d5_mean_weight_expanded",
"test_onehot_negative_indices", // Issue:: Layer does not exist (OneHot) :: Can't create layer "onnx_node_output_0!y" of type "OneHot" in function 'getLayerInstance'
"test_onehot_with_axis", // ---- same as above ---
"test_onehot_with_negative_axis", // ---- same as above ---
@@ -653,75 +626,7 @@
"test_rotary_embedding_with_rotary_dim",
"test_rotary_embedding_with_rotary_dim_expanded",
"test_scan9_sum", // Issue:: Parser: 'Graph' is not supported in function 'getLayerParams'
"test_scan_sum", // ---- same as above ---
"test_sce_NCd1_mean_weight_negative_ii", // Issue:: Parser: Layer does not exist (NegativeLogLikelihoodLoss, SoftmaxCrossEntropyLoss)
"test_sce_NCd1_mean_weight_negative_ii_expanded", // ---- same as above ---
"test_sce_NCd1_mean_weight_negative_ii_log_prob", // ---- same as above ---
"test_sce_NCd1_mean_weight_negative_ii_log_prob_expanded", // ---- same as above ---
"test_sce_NCd1d2d3_none_no_weight_negative_ii", // ---- same as above ---
"test_sce_NCd1d2d3_none_no_weight_negative_ii_expanded", // ---- same as above ---
"test_sce_NCd1d2d3_none_no_weight_negative_ii_log_prob", // ---- same as above ---
"test_sce_NCd1d2d3_none_no_weight_negative_ii_log_prob_expanded", // ---- same as above ---
"test_sce_NCd1d2d3_sum_weight_high_ii", // ---- same as above ---
"test_sce_NCd1d2d3_sum_weight_high_ii_expanded", // ---- same as above ---
"test_sce_NCd1d2d3_sum_weight_high_ii_log_prob", // ---- same as above ---
"test_sce_NCd1d2d3_sum_weight_high_ii_log_prob_expanded", // ---- same as above ---
"test_sce_NCd1d2d3d4d5_mean_weight", // ---- same as above ---
"test_sce_NCd1d2d3d4d5_mean_weight_expanded", // ---- same as above ---
"test_sce_NCd1d2d3d4d5_mean_weight_log_prob", // ---- same as above ---
"test_sce_NCd1d2d3d4d5_mean_weight_log_prob_expanded", // ---- same as above ---
"test_sce_NCd1d2d3d4d5_none_no_weight", // ---- same as above ---
"test_sce_NCd1d2d3d4d5_none_no_weight_expanded", // ---- same as above ---
"test_sce_NCd1d2d3d4d5_none_no_weight_log_prob", // ---- same as above ---
"test_sce_NCd1d2d3d4d5_none_no_weight_log_prob_expanded", // ---- same as above ---
"test_sce_mean", // Issue:: Parser: Layer does not exist (NegativeLogLikelihoodLoss, SoftmaxCrossEntropyLoss)
"test_sce_mean_3d", // ---- same as above ---
"test_sce_mean_3d_expanded", // ---- same as above ---
"test_sce_mean_3d_log_prob", // ---- same as above ---
"test_sce_mean_3d_log_prob_expanded", // ---- same as above ---
"test_sce_mean_expanded", // ---- same as above ---
"test_sce_mean_log_prob", // ---- same as above ---
"test_sce_mean_log_prob_expanded", // ---- same as above ---
"test_sce_mean_no_weight_ii", // ---- same as above ---
"test_sce_mean_no_weight_ii_3d", // ---- same as above ---
"test_sce_mean_no_weight_ii_3d_expanded", // ---- same as above ---
"test_sce_mean_no_weight_ii_3d_log_prob", // ---- same as above ---
"test_sce_mean_no_weight_ii_3d_log_prob_expanded", // ---- same as above ---
"test_sce_mean_no_weight_ii_4d", // ---- same as above ---
"test_sce_mean_no_weight_ii_4d_expanded", // ---- same as above ---
"test_sce_mean_no_weight_ii_4d_log_prob", // ---- same as above ---
"test_sce_mean_no_weight_ii_4d_log_prob_expanded", // ---- same as above ---
"test_sce_mean_no_weight_ii_expanded", // ---- same as above ---
"test_sce_mean_no_weight_ii_log_prob", // ---- same as above ---
"test_sce_mean_no_weight_ii_log_prob_expanded", // ---- same as above ---
"test_sce_mean_weight", // ---- same as above ---
"test_sce_mean_weight_expanded", // ---- same as above ---
"test_sce_mean_weight_ii", // ---- same as above ---
"test_sce_mean_weight_ii_3d", // ---- same as above ---
"test_sce_mean_weight_ii_3d_expanded", // ---- same as above ---
"test_sce_mean_weight_ii_3d_log_prob", // ---- same as above ---
"test_sce_mean_weight_ii_3d_log_prob_expanded", // ---- same as above ---
"test_sce_mean_weight_ii_4d", // ---- same as above ---
"test_sce_mean_weight_ii_4d_expanded", // ---- same as above ---
"test_sce_mean_weight_ii_4d_log_prob", // ---- same as above ---
"test_sce_mean_weight_ii_4d_log_prob_expanded", // ---- same as above ---
"test_sce_mean_weight_ii_expanded", // ---- same as above ---
"test_sce_mean_weight_ii_log_prob", // ---- same as above ---
"test_sce_mean_weight_ii_log_prob_expanded", // ---- same as above ---
"test_sce_mean_weight_log_prob", // ---- same as above ---
"test_sce_mean_weight_log_prob_expanded", // ---- same as above ---
"test_sce_none", // ---- same as above ---
"test_sce_none_expanded", // ---- same as above ---
"test_sce_none_log_prob", // ---- same as above ---
"test_sce_none_log_prob_expanded", // ---- same as above ---
"test_sce_none_weights", // ---- same as above ---
"test_sce_none_weights_expanded", // ---- same as above ---
"test_sce_none_weights_log_prob", // ---- same as above ---
"test_sce_none_weights_log_prob_expanded", // ---- same as above ---
"test_sce_sum", // ---- same as above ---
"test_sce_sum_expanded", // ---- same as above ---
"test_sce_sum_log_prob", // ---- same as above ---
"test_sce_sum_log_prob_expanded", // ---- same as above ---
"test_scan_sum", // ---- same as above ---
"test_sequence_insert_at_back", // Issue:: Parser: typeProto.has_tensor_type() in function 'populateNet'
"test_sequence_insert_at_front", // ---- same as above ---
"test_sequence_map_add_1_sequence_1_tensor",