Browse Source

Fix ReadValueMatrix ReadBytes issue in .NET 6.0. #880

tags/v0.70.2-NET6
Haiping Chen 2 years ago
parent
commit
19363cdf11
9 changed files with 20 additions and 10 deletions
  1. +1
    -1
      src/TensorFlowNET.Console/Tensorflow.Console.csproj
  2. +2
    -3
      src/TensorFlowNET.Core/NumPy/Implementation/NumPyImpl.Creation.cs
  3. +1
    -1
      src/TensorFlowNET.Core/Tensorflow.Binding.csproj
  4. +1
    -1
      src/TensorFlowNet.Benchmarks/Tensorflow.Benchmark.csproj
  5. +1
    -1
      test/TensorFlowNET.Graph.UnitTest/TensorFlowNET.Graph.UnitTest.csproj
  6. +1
    -1
      test/TensorFlowNET.Keras.UnitTest/Tensorflow.Keras.UnitTest.csproj
  7. +1
    -1
      test/TensorFlowNET.Native.UnitTest/Tensorflow.Native.UnitTest.csproj
  8. +11
    -0
      test/TensorFlowNET.UnitTest/ManagedAPI/LinalgTest.cs
  9. +1
    -1
      test/TensorFlowNET.UnitTest/Tensorflow.Binding.UnitTest.csproj

+ 1
- 1
src/TensorFlowNET.Console/Tensorflow.Console.csproj View File

@@ -2,7 +2,7 @@


<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>Tensorflow</RootNamespace> <RootNamespace>Tensorflow</RootNamespace>
<AssemblyName>Tensorflow</AssemblyName> <AssemblyName>Tensorflow</AssemblyName>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>


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

@@ -90,9 +90,8 @@ namespace Tensorflow.NumPy
int total = 1; int total = 1;
for (int i = 0; i < shape.Length; i++) for (int i = 0; i < shape.Length; i++)
total *= shape[i]; total *= shape[i];
var buffer = new byte[bytes * total];

reader.Read(buffer, 0, buffer.Length);
var buffer = reader.ReadBytes(bytes * total);
System.Buffer.BlockCopy(buffer, 0, matrix, 0, buffer.Length); System.Buffer.BlockCopy(buffer, 0, matrix, 0, buffer.Length);


return matrix; return matrix;


+ 1
- 1
src/TensorFlowNET.Core/Tensorflow.Binding.csproj View File

@@ -5,7 +5,7 @@
<AssemblyName>Tensorflow.Binding</AssemblyName> <AssemblyName>Tensorflow.Binding</AssemblyName>
<RootNamespace>Tensorflow</RootNamespace> <RootNamespace>Tensorflow</RootNamespace>
<TargetTensorFlow>2.2.0</TargetTensorFlow> <TargetTensorFlow>2.2.0</TargetTensorFlow>
<Version>0.70.1</Version>
<Version>0.70.2</Version>
<LangVersion>9.0</LangVersion> <LangVersion>9.0</LangVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Authors>Haiping Chen, Meinrad Recheis, Eli Belash</Authors> <Authors>Haiping Chen, Meinrad Recheis, Eli Belash</Authors>


+ 1
- 1
src/TensorFlowNet.Benchmarks/Tensorflow.Benchmark.csproj View File

@@ -2,7 +2,7 @@


<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
</PropertyGroup> </PropertyGroup>




+ 1
- 1
test/TensorFlowNET.Graph.UnitTest/TensorFlowNET.Graph.UnitTest.csproj View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">


<PropertyGroup> <PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>9.0</LangVersion> <LangVersion>9.0</LangVersion>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<AssemblyName>TensorFlowNET.UnitTest</AssemblyName> <AssemblyName>TensorFlowNET.UnitTest</AssemblyName>


+ 1
- 1
test/TensorFlowNET.Keras.UnitTest/Tensorflow.Keras.UnitTest.csproj View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">


<PropertyGroup> <PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>


<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>




+ 1
- 1
test/TensorFlowNET.Native.UnitTest/Tensorflow.Native.UnitTest.csproj View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">


<PropertyGroup> <PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>


<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>




+ 11
- 0
test/TensorFlowNET.UnitTest/ManagedAPI/LinalgTest.cs View File

@@ -77,5 +77,16 @@ namespace TensorFlowNET.UnitTest.ManagedAPI
Assert.AreEqual(c.shape.ndim, 0); Assert.AreEqual(c.shape.ndim, 0);
Assert.AreEqual(c.numpy(), 8); Assert.AreEqual(c.numpy(), 8);
} }

[TestMethod]
public void Matmul()
{
var a = tf.constant(new[] { 1, 2, 3, 4, 5, 6 }, shape: (2, 3));
var b = tf.constant(new[] { 7, 8, 9, 10, 11, 12 }, shape: (3, 2));
var c = tf.linalg.matmul(a, b);

Assert.AreEqual(c.shape, (2, 2));
AssetSequenceEqual(c.ToArray<int>(), new[] { 58, 64, 139, 154 });
}
} }
} }

+ 1
- 1
test/TensorFlowNET.UnitTest/Tensorflow.Binding.UnitTest.csproj View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">


<PropertyGroup> <PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>


<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>




Loading…
Cancel
Save