Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,51 +127,51 @@
DML_OPERATOR_DESC& desc = descs[i];
ActivationOperatorDescUnion& activationDesc = m_activationDescs[i];
desc.Desc = &activationDesc;

if (activationName == AttrValue::ActivationRelu)

Check warning on line 130 in onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp

View workflow job for this annotation

GitHub Actions / Optional Lint C++

[cpplint] reported by reviewdog 🐶 Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4] Raw Output: onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp:130: Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]
if (CompareActivationName(activationName, AttrValue::ActivationRelu))
{
desc.Type = DML_OPERATOR_ACTIVATION_RELU;
}
else if (activationName == AttrValue::ActivationLeakyRelu)
}

Check warning on line 134 in onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp

View workflow job for this annotation

GitHub Actions / Optional Lint C++

[cpplint] reported by reviewdog 🐶 Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4] Raw Output: onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp:134: Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]
else if (CompareActivationName(activationName, AttrValue::ActivationLeakyRelu))
{
desc.Type = DML_OPERATOR_ACTIVATION_LEAKY_RELU;
activationDesc.leakyRelu.Alpha = NextAlpha(desc.Type);
}
else if (activationName == AttrValue::ActivationThresholdedRelu)
else if (CompareActivationName(activationName, AttrValue::ActivationThresholdedRelu))
{
desc.Type = DML_OPERATOR_ACTIVATION_THRESHOLDED_RELU;
activationDesc.thresholdedRelu.Alpha = NextAlpha(desc.Type);
}
else if (activationName == AttrValue::ActivationTanh)
}

Check warning on line 144 in onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp

View workflow job for this annotation

GitHub Actions / Optional Lint C++

[cpplint] reported by reviewdog 🐶 Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4] Raw Output: onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp:144: Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]
else if (CompareActivationName(activationName, AttrValue::ActivationTanh))
{
desc.Type = DML_OPERATOR_ACTIVATION_TANH;
}
else if (activationName == AttrValue::ActivationScaledTanh)
}

Check warning on line 148 in onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp

View workflow job for this annotation

GitHub Actions / Optional Lint C++

[cpplint] reported by reviewdog 🐶 Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4] Raw Output: onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp:148: Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]
else if (CompareActivationName(activationName, AttrValue::ActivationScaledTanh))
{
desc.Type = DML_OPERATOR_ACTIVATION_SCALED_TANH;
activationDesc.scaledTanh.Alpha = NextAlpha(desc.Type);
activationDesc.scaledTanh.Beta = NextBeta(desc.Type);
}
else if (activationName == AttrValue::ActivationSigmoid)
}

Check warning on line 154 in onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp

View workflow job for this annotation

GitHub Actions / Optional Lint C++

[cpplint] reported by reviewdog 🐶 Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4] Raw Output: onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp:154: Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]
else if (CompareActivationName(activationName, AttrValue::ActivationSigmoid))
{
desc.Type = DML_OPERATOR_ACTIVATION_SIGMOID;
}
else if (activationName == AttrValue::ActivationSigmoidHard)
}

Check warning on line 158 in onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp

View workflow job for this annotation

GitHub Actions / Optional Lint C++

[cpplint] reported by reviewdog 🐶 Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4] Raw Output: onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp:158: Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]
else if (CompareActivationName(activationName, AttrValue::ActivationSigmoidHard))
{
desc.Type = DML_OPERATOR_ACTIVATION_HARD_SIGMOID;
activationDesc.hardSigmoid.Alpha = NextAlpha(desc.Type);
activationDesc.hardSigmoid.Beta = NextBeta(desc.Type);
}
else if (activationName == AttrValue::ActivationElu)
}

Check warning on line 164 in onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp

View workflow job for this annotation

GitHub Actions / Optional Lint C++

[cpplint] reported by reviewdog 🐶 Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4] Raw Output: onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp:164: Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]
else if (CompareActivationName(activationName, AttrValue::ActivationElu))
{
desc.Type = DML_OPERATOR_ACTIVATION_ELU;
activationDesc.elu.Alpha = NextAlpha(desc.Type);
}
else if (activationName == AttrValue::ActivationSoftsign)
}

Check warning on line 169 in onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp

View workflow job for this annotation

GitHub Actions / Optional Lint C++

[cpplint] reported by reviewdog 🐶 Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4] Raw Output: onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp:169: Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]
else if (CompareActivationName(activationName, AttrValue::ActivationSoftsign))
{
desc.Type = DML_OPERATOR_ACTIVATION_SOFTSIGN;
}
else if (activationName == AttrValue::ActivationSoftplus)
}

Check warning on line 173 in onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp

View workflow job for this annotation

GitHub Actions / Optional Lint C++

[cpplint] reported by reviewdog 🐶 Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4] Raw Output: onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp:173: Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]
else if (CompareActivationName(activationName, AttrValue::ActivationSoftplus))
{
desc.Type = DML_OPERATOR_ACTIVATION_SOFTPLUS;
}
Expand All @@ -182,6 +182,17 @@
}
}

bool CompareActivationName(std::string_view activationName, std::string_view attrValue)
{
if (activationName.size() != attrValue.size())

Check warning on line 187 in onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp

View workflow job for this annotation

GitHub Actions / Optional Lint C++

[cpplint] reported by reviewdog 🐶 Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4] Raw Output: onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp:187: Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]
{
return false;
}

auto comparer = [](char a, char b) {return std::tolower(a) == std::tolower(b);};
return std::equal(activationName.begin(), activationName.end(), attrValue.begin(), attrValue.end(), comparer);
}

void Compute(const MLOperatorKernelContext& kernelContext) override
{
// Assume that enough GPU work has been queued up after the RNN operator that it is worth
Expand Down
Loading
Loading