Browse Source

improve unpickler speed with BufferedStream

tags/v0.110.4-Transformer-Model
lingbai-kong 2 years ago
parent
commit
56e389154c
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      src/TensorFlowNET.Core/NumPy/Implementation/NumPyImpl.Creation.cs

+ 3
- 2
src/TensorFlowNET.Core/NumPy/Implementation/NumPyImpl.Creation.cs View File

@@ -101,9 +101,10 @@ namespace Tensorflow.NumPy

Array ReadObjectMatrix(BinaryReader reader, Array matrix, int[] shape)
{
Stream stream = reader.BaseStream;
Stream deflateStream = reader.BaseStream;
BufferedStream bufferedStream = new BufferedStream(deflateStream);
var unpickler = new Unpickler();
return (MultiArrayPickleWarpper)unpickler.load(stream);
return (MultiArrayPickleWarpper)unpickler.load(bufferedStream);
}

public (NDArray, NDArray) meshgrid<T>(T[] array, bool copy = true, bool sparse = false)


Loading…
Cancel
Save