| @@ -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, | |||
| @@ -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; | |||
| } | |||
| @@ -60,7 +60,7 @@ https://tensorflownet.readthedocs.io</Description> | |||
| <ItemGroup> | |||
| <PackageReference Include="Google.Protobuf" Version="3.11.2" /> | |||
| <PackageReference Include="NumSharp" Version="0.20.5" /> | |||
| <PackageReference Include="NumSharp" Version="0.30.0-alpha" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| @@ -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<uint>()[0]; | |||
| return np.frombuffer(buffer, ">u4").Data<int>()[0]; | |||
| } | |||
| } | |||
| } | |||
| @@ -2,7 +2,7 @@ | |||
| <PropertyGroup> | |||
| <RootNamespace>Tensorflow.Hub</RootNamespace> | |||
| <TargetFramework>netstandard2.0</TargetFramework> | |||
| <Version>0.0.5</Version> | |||
| <Version>0.0.6</Version> | |||
| <Authors>Kerry Jiang, Haiping Chen</Authors> | |||
| <Company>SciSharp STACK</Company> | |||
| <Copyright>Apache 2.0</Copyright> | |||
| @@ -13,7 +13,8 @@ | |||
| <Description>TensorFlow Hub is a library to foster the publication, discovery, and consumption of reusable parts of machine learning models.</Description> | |||
| <PackageId>SciSharp.TensorFlowHub</PackageId> | |||
| <GeneratePackageOnBuild>true</GeneratePackageOnBuild> | |||
| <PackageReleaseNotes>Fix GetNextBatch() bug.</PackageReleaseNotes> | |||
| <PackageReleaseNotes>Fix GetNextBatch() bug. | |||
| Change to NumSharp compact version.</PackageReleaseNotes> | |||
| <PackageIconUrl>https://avatars3.githubusercontent.com/u/44989469?s=200&v=4</PackageIconUrl> | |||
| <AssemblyName>TensorFlow.Hub</AssemblyName> | |||
| </PropertyGroup> | |||
| @@ -21,6 +22,6 @@ | |||
| <DefineConstants>DEBUG;TRACE</DefineConstants> | |||
| </PropertyGroup> | |||
| <ItemGroup> | |||
| <PackageReference Include="NumSharp" Version="0.20.5" /> | |||
| <PackageReference Include="NumSharp" Version="0.30.0-alpha" /> | |||
| </ItemGroup> | |||
| </Project> | |||