@@ -229,7 +229,7 @@ private void CanRunInferenceOnAModel(GraphOptimizationLevel graphOptimizationLev
229229 {
230230 string modelPath = Path . Combine ( Directory . GetCurrentDirectory ( ) , "squeezenet.onnx" ) ;
231231
232- using ( var cleanUp = new DisposableList < IDisposable > ( ) )
232+ using ( var cleanUp = new DisposableListTest < IDisposable > ( ) )
233233 {
234234 // Set the graph optimization level for this session.
235235 SessionOptions options = new SessionOptions ( ) ;
@@ -312,7 +312,7 @@ private void CanRunInferenceOnAModel(GraphOptimizationLevel graphOptimizationLev
312312 Assert . Equal ( typeof ( float ) , inputMeta [ inputName ] . ElementType ) ;
313313 Assert . True ( inputMeta [ inputName ] . IsTensor ) ;
314314 var longShape = Array . ConvertAll < int , long > ( inputMeta [ inputName ] . Dimensions , d => d ) ;
315- var byteSize = ArrayUtilities . GetSizeForShape ( longShape ) * sizeof ( float ) ;
315+ var byteSize = longShape . Aggregate ( 1L , ( a , b ) => a * b ) * sizeof ( float ) ;
316316 pinnedInputs . Add ( FixedBufferOnnxValue . CreateFromMemory < float > ( memInfo , inputData ,
317317 TensorElementType . Float , longShape , byteSize ) ) ;
318318
@@ -324,7 +324,7 @@ private void CanRunInferenceOnAModel(GraphOptimizationLevel graphOptimizationLev
324324 Assert . Equal ( typeof ( float ) , outputMeta [ outputName ] . ElementType ) ;
325325 Assert . True ( outputMeta [ outputName ] . IsTensor ) ;
326326 longShape = Array . ConvertAll < int , long > ( outputMeta [ outputName ] . Dimensions , d => d ) ;
327- byteSize = ArrayUtilities . GetSizeForShape ( longShape ) * sizeof ( float ) ;
327+ byteSize = longShape . Aggregate ( 1L , ( a , b ) => a * b ) * sizeof ( float ) ;
328328 float [ ] outputBuffer = new float [ expectedOutput . Length ] ;
329329 pinnedOutputs . Add ( FixedBufferOnnxValue . CreateFromMemory < float > ( memInfo , outputBuffer ,
330330 TensorElementType . Float , longShape , byteSize ) ) ;
0 commit comments