Skip to content

Commit 96055c5

Browse files
committed
Changed where copy was being made so its still only made once.
1 parent 57c7b2f commit 96055c5

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/Microsoft.ML.OnnxTransformer/OnnxTransform.cs

+3-4
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ private class NamedOnnxValueGetterVec<T> : INamedOnnxValueGetter
805805
public NamedOnnxValueGetterVec(DataViewRow input, int colIndex, OnnxShape tensorShape)
806806
{
807807
_srcGetter = input.GetGetter<VBuffer<T>>(input.Schema[colIndex]);
808-
_tensorShape = tensorShape;
808+
_tensorShape = new OnnxShape(tensorShape);
809809
_colName = input.Schema[colIndex].Name;
810810
_vBuffer = default;
811811
_vBufferDense = default;
@@ -840,9 +840,8 @@ private NamedOnnxValue GetNamedOnnxValueUnknownSize()
840840
{
841841
GetNamedOnnxValueCore();
842842

843-
var tensorShape = new OnnxShape(_tensorShape);
844-
tensorShape[_zeroIndex] = _vBufferDense.Length / _denominator;
845-
return OnnxUtils.CreateNamedOnnxValue(_colName, _vBufferDense.GetValues(), tensorShape);
843+
_tensorShape[_zeroIndex] = _vBufferDense.Length / _denominator;
844+
return OnnxUtils.CreateNamedOnnxValue(_colName, _vBufferDense.GetValues(), _tensorShape);
846845
}
847846
}
848847
}

0 commit comments

Comments
 (0)