diff --git a/src/TensorFlowNET.Core/Operations/random_ops.cs b/src/TensorFlowNET.Core/Operations/random_ops.cs index bd718768..c722c9c0 100644 --- a/src/TensorFlowNET.Core/Operations/random_ops.cs +++ b/src/TensorFlowNET.Core/Operations/random_ops.cs @@ -80,7 +80,7 @@ namespace Tensorflow } public static Tensor random_uniform(Tensor shape, - long minval = 0, + int minval = 0, Tensor maxval = null, TF_DataType dtype = TF_DataType.TF_FLOAT, int? seed = null, diff --git a/src/TensorFlowNET.Core/Sessions/_ElementFetchMapper.cs b/src/TensorFlowNET.Core/Sessions/_ElementFetchMapper.cs index 48eddf3b..12422289 100644 --- a/src/TensorFlowNET.Core/Sessions/_ElementFetchMapper.cs +++ b/src/TensorFlowNET.Core/Sessions/_ElementFetchMapper.cs @@ -58,51 +58,18 @@ namespace Tensorflow case NDArray value: result = new[] { value }; break; -#if _REGEN - %types=["sbyte", "bool", "byte", "short", "ushort", "int", "uint", "long", "ulong", "float", "double", "Complex"] - %foreach types% - case #1 value: - result = new[] { NDArray.Scalar(value) }; - break; - % -#else - case sbyte value: - result = new[] { NDArray.Scalar(value) }; - break; case bool value: result = new[] { NDArray.Scalar(value) }; break; case byte value: result = new[] { NDArray.Scalar(value) }; break; - case short value: - result = new[] { NDArray.Scalar(value) }; - break; - case ushort value: - result = new[] { NDArray.Scalar(value) }; - break; case int value: result = new[] { NDArray.Scalar(value) }; break; - case uint value: - result = new[] { NDArray.Scalar(value) }; - break; - case long value: - result = new[] { NDArray.Scalar(value) }; - break; - case ulong value: - result = new[] { NDArray.Scalar(value) }; - break; case float value: result = new[] { NDArray.Scalar(value) }; break; - case double value: - result = new[] { NDArray.Scalar(value) }; - break; - case Complex value: - result = new[] { NDArray.Scalar(value) }; - break; -#endif default: break; } diff --git a/src/TensorFlowNET.Core/TensorFlow.Binding.csproj b/src/TensorFlowNET.Core/TensorFlow.Binding.csproj index ea93f37d..031d2b10 100644 --- a/src/TensorFlowNET.Core/TensorFlow.Binding.csproj +++ b/src/TensorFlowNET.Core/TensorFlow.Binding.csproj @@ -60,7 +60,7 @@ https://tensorflownet.readthedocs.io - + diff --git a/src/TensorFlowNET.Hub/MnistModelLoader.cs b/src/TensorFlowNET.Hub/MnistModelLoader.cs index 4fdd69b6..82096452 100644 --- a/src/TensorFlowNET.Hub/MnistModelLoader.cs +++ b/src/TensorFlowNET.Hub/MnistModelLoader.cs @@ -116,7 +116,7 @@ namespace Tensorflow.Hub throw new Exception($"Invalid magic number {magic} in MNIST image file: {file}"); var num_images = Read32(bytestream); - num_images = limit == null ? num_images : Math.Min(num_images, (uint)limit); + num_images = limit == null ? num_images : Math.Min(num_images, (int)limit); var rows = Read32(bytestream); var cols = Read32(bytestream); @@ -125,8 +125,8 @@ namespace Tensorflow.Hub bytestream.Read(buf, 0, buf.Length); - var data = np.frombuffer(buf, np.uint8); - data = data.reshape((int)num_images, (int)rows, (int)cols, 1); + var data = np.frombuffer(buf, np.@byte); + data = data.reshape(num_images, rows, cols, 1); return data; } @@ -144,7 +144,7 @@ namespace Tensorflow.Hub throw new Exception($"Invalid magic number {magic} in MNIST label file: {file}"); var num_items = Read32(bytestream); - num_items = limit == null ? num_items : Math.Min(num_items, (uint)limit); + num_items = limit == null ? num_items : Math.Min(num_items, (int)limit); var buf = new byte[num_items]; @@ -174,11 +174,11 @@ namespace Tensorflow.Hub return labels_one_hot; } - private uint Read32(FileStream bytestream) + private int Read32(FileStream bytestream) { var buffer = new byte[sizeof(uint)]; var count = bytestream.Read(buffer, 0, 4); - return np.frombuffer(buffer, ">u4").Data()[0]; + return np.frombuffer(buffer, ">u4").Data()[0]; } } } diff --git a/src/TensorFlowNET.Hub/Tensorflow.Hub.csproj b/src/TensorFlowNET.Hub/Tensorflow.Hub.csproj index abb80f67..640e1515 100644 --- a/src/TensorFlowNET.Hub/Tensorflow.Hub.csproj +++ b/src/TensorFlowNET.Hub/Tensorflow.Hub.csproj @@ -2,7 +2,7 @@ Tensorflow.Hub netstandard2.0 - 0.0.5 + 0.0.6 Kerry Jiang, Haiping Chen SciSharp STACK Apache 2.0 @@ -13,7 +13,8 @@ TensorFlow Hub is a library to foster the publication, discovery, and consumption of reusable parts of machine learning models. SciSharp.TensorFlowHub true - Fix GetNextBatch() bug. + Fix GetNextBatch() bug. +Change to NumSharp compact version. https://avatars3.githubusercontent.com/u/44989469?s=200&v=4 TensorFlow.Hub @@ -21,6 +22,6 @@ DEBUG;TRACE - + \ No newline at end of file