mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-29 20:14:01 +00:00
Merged PR 5253310: Fix 0-sized dimension broadcasting
Tensors that contain 0-sized dimensions were being broadcasted to higher dimensions, which would remove the possibility to remove them from the graph. 0-sized dimensions represent empty tensors, so whatever operator needs to broadcast it shouldn't try to call into DML.
This commit is contained in:
parent
3165d8045b
commit
891175d5d6
1 changed files with 7 additions and 0 deletions
|
|
@ -550,6 +550,13 @@ namespace OperatorHelper
|
|||
++inDim1Iter;
|
||||
}
|
||||
|
||||
// 0-sized dimensions indicate an empty tensor and shouldn't be broadcasted to higher dimensions
|
||||
if (inDimension0 == 0 || inDimension1 == 0)
|
||||
{
|
||||
inDimension0 = 0;
|
||||
inDimension1 = 0;
|
||||
}
|
||||
|
||||
ML_CHECK_VALID_ARGUMENT((inDimension0 == inDimension1) || (inDimension0 == 1) || (inDimension1 == 1));
|
||||
*outDimIter = std::max(inDimension0, inDimension1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue