Merged PR 6512710: Code clean up in DmlOperatorPadding

Addressed comments on the [PR:6511109](https://microsoft.visualstudio.com/DefaultCollection/WindowsAI/_git/onnxruntime/pullrequest/6511109)
This commit is contained in:
Sumit Agarwal 2021-09-29 03:16:57 +00:00
parent 8bcd076f3d
commit 39c2d76c4e

View file

@ -73,14 +73,14 @@ public:
// Same applies to paddingValue.
paddingDesc.PaddingValueDataType = this->m_inputTensorDescs[0].GetDmlDataType();
CastToScalarUnion<float>(paddingDesc.PaddingValueDataType, 0.0f, /*out*/&paddingDesc.PaddingValue);
// Read the constant value which can come from an attribute or tensor.
if (opsetVersion >= 11)
{
if (kernelInfo.IsInputValid(2))
{
MLOperatorTensor constantPaddingValueTensor = kernelInfo.GetConstantInputTensor(2);
ReadScalarTensorData(kernelInfo.GetConstantInputTensor(2), /*out*/ &paddingDesc.PaddingValue.Bytes, sizeof(paddingDesc.PaddingValue.Bytes));
ReadScalarTensorData(constantPaddingValueTensor, /*out*/ &paddingDesc.PaddingValue.Bytes, sizeof(paddingDesc.PaddingValue.Bytes));
}
}
else