| @@ -377,8 +377,8 @@ namespace Tensorflow.Gradients | |||
| grad, | |||
| op.get_attr_list<int>("ksize"), | |||
| op.get_attr_list<int>("strides"), | |||
| op.get_attr("padding").ToString(), | |||
| op.get_attr("data_format").ToString()) | |||
| op.get_attr<string>("padding"), | |||
| op.get_attr<string>("data_format")) | |||
| }; | |||
| } | |||
| @@ -206,12 +206,11 @@ namespace Tensorflow | |||
| return result; | |||
| } | |||
| internal unsafe int _get_attr_int(string name) | |||
| internal unsafe long _get_attr_int(string name) | |||
| { | |||
| Status status = new(); | |||
| int result; | |||
| c_api.TF_OperationGetAttrInt(_handle, name, new IntPtr(&result), status); | |||
| status.Check(true); | |||
| long result; | |||
| c_api.TF_OperationGetAttrInt(_handle, name, new IntPtr(&result), tf.Status); | |||
| tf.Status.Check(true); | |||
| return result; | |||
| } | |||
| @@ -4,11 +4,11 @@ | |||
| <TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks> | |||
| <AssemblyName>Tensorflow.Binding</AssemblyName> | |||
| <RootNamespace>Tensorflow</RootNamespace> | |||
| <TargetTensorFlow>2.10.0</TargetTensorFlow> | |||
| <Version>0.110.1</Version> | |||
| <TargetTensorFlow>2.11.0</TargetTensorFlow> | |||
| <Version>0.110.2</Version> | |||
| <LangVersion>10.0</LangVersion> | |||
| <Nullable>enable</Nullable> | |||
| <Authors>Haiping Chen, Meinrad Recheis, Eli Belash</Authors> | |||
| <Authors>Haiping Chen, Eli Belash, Yaohui Liu, Meinrad Recheis</Authors> | |||
| <Company>SciSharp STACK</Company> | |||
| <GeneratePackageOnBuild>False</GeneratePackageOnBuild> | |||
| <Copyright>Apache 2.0, Haiping Chen $([System.DateTime]::UtcNow.ToString(yyyy))</Copyright> | |||
| @@ -23,7 +23,8 @@ https://tensorflownet.readthedocs.io</Description> | |||
| <AssemblyVersion>0.110.1.0</AssemblyVersion> | |||
| <PackageReleaseNotes> | |||
| tf.net 0.110.x and above are based on tensorflow native 2.11.0 | |||
| * RNN, LSTM works. | |||
| * Support RNN, LSTM model. | |||
| * Support Transformer model. | |||
| tf.net 0.100.x and above are based on tensorflow native 2.10.0 | |||
| @@ -42,12 +43,11 @@ https://tensorflownet.readthedocs.io</Description> | |||
| tf.net 0.10x.x aligns with TensorFlow v2.10.x native library. | |||
| tf.net 0.11x.x aligns with TensorFlow v2.11.x native library. | |||
| </PackageReleaseNotes> | |||
| <FileVersion>0.110.1.0</FileVersion> | |||
| <FileVersion>0.110.2.0</FileVersion> | |||
| <PackageLicenseFile>LICENSE</PackageLicenseFile> | |||
| <PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance> | |||
| <PackageOutputPath>packages</PackageOutputPath> | |||
| <SignAssembly>true</SignAssembly> | |||
| <AssemblyOriginatorKeyFile>Open.snk</AssemblyOriginatorKeyFile> | |||
| <Platforms>AnyCPU;x64</Platforms> | |||
| <PackageId>TensorFlow.NET</PackageId> | |||
| <Configurations>Debug;Release;GPU</Configurations> | |||
| @@ -88,6 +88,66 @@ https://tensorflownet.readthedocs.io</Description> | |||
| <DefineConstants /> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.0|AnyCPU'"> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1570,1573,1591,1712,8603,8604,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.0|x64'"> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1570,1573,1591,1712,8603,8604,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netstandard2.0|AnyCPU'"> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1570,1573,1591,1712,8603,8604,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netstandard2.0|x64'"> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1570,1573,1591,1712,8603,8604,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='GPU|netstandard2.0|AnyCPU'"> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1570,1573,1591,1712,8603,8604,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='GPU|netstandard2.0|x64'"> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1570,1573,1591,1712,8603,8604,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0|AnyCPU'"> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1570,1573,1591,1712,8603,8604,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0|x64'"> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1570,1573,1591,1712,8603,8604,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0|AnyCPU'"> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1570,1573,1591,1712,8603,8604,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0|x64'"> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1570,1573,1591,1712,8603,8604,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='GPU|net6.0|AnyCPU'"> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1570,1573,1591,1712,8603,8604,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='GPU|net6.0|x64'"> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1570,1573,1591,1712,8603,8604,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <ItemGroup> | |||
| <Compile Remove="Distribute\**" /> | |||
| <Compile Remove="Models\**" /> | |||
| @@ -180,8 +180,7 @@ namespace Tensorflow | |||
| array_ops.stack(end.ToArray()), | |||
| array_ops.stack(strides.ToArray())); | |||
| return gen_array_ops.strided_slice( | |||
| this, | |||
| return array_ops.strided_slice(this, | |||
| packed_begin, | |||
| packed_end, | |||
| packed_strides, | |||
| @@ -44,7 +44,6 @@ namespace Tensorflow.Keras | |||
| /// <summary> | |||
| /// Register the name-activation mapping in this static class. | |||
| /// </summary> | |||
| /// <param name="name"></param> | |||
| /// <param name="activation"></param> | |||
| private static void RegisterActivation(Activation activation) | |||
| { | |||
| @@ -5,9 +5,6 @@ namespace Tensorflow.Keras.Callbacks; | |||
| /// <summary> | |||
| /// Stop training when a monitored metric has stopped improving. | |||
| /// </summary> | |||
| /// <param name="parameters"></param> | |||
| /// <param name="monitor"></param> | |||
| public class EarlyStopping: ICallback | |||
| { | |||
| int _paitence; | |||
| @@ -52,7 +52,7 @@ namespace Tensorflow.Keras.Engine.DataAdapters | |||
| /// <summary> | |||
| /// Convert a Tensor of indices into a dataset of batched indices. | |||
| /// </summary> | |||
| /// <param name="tensor"></param> | |||
| /// <param name="indices"></param> | |||
| /// <returns></returns> | |||
| IDatasetV2 slice_batch_indices(Tensor indices) | |||
| { | |||
| @@ -10,7 +10,7 @@ namespace Tensorflow.Keras.Engine | |||
| /// Wraps `call`, applying pre- and post-processing steps. | |||
| /// </summary> | |||
| /// <param name="inputs"></param> | |||
| /// <param name="state"></param> | |||
| /// <param name="states"></param> | |||
| /// <param name="training"></param> | |||
| /// <returns></returns> | |||
| public virtual Tensors Apply(Tensors inputs, Tensors states = null, bool? training = false, IOptionalArgs? optional_args = null) | |||
| @@ -1,7 +1,5 @@ | |||
| using System; | |||
| using Tensorflow.Keras.Utils; | |||
| using static Tensorflow.Binding; | |||
| using static Tensorflow.KerasApi; | |||
| namespace Tensorflow.Keras.Engine | |||
| { | |||
| @@ -9,14 +7,6 @@ namespace Tensorflow.Keras.Engine | |||
| { | |||
| Tensors FunctionalConstructionCall(Tensors inputs) | |||
| { | |||
| bool mask_arg_passed_by_framework = false; | |||
| bool training_arg_passed_by_framework = false; | |||
| Tensor training_value = null; | |||
| if (training_value == null) | |||
| { | |||
| training_arg_passed_by_framework = true; | |||
| } | |||
| if (base_layer_utils.needs_keras_history(inputs)) | |||
| base_layer_utils.create_keras_history(inputs); | |||
| @@ -15,7 +15,7 @@ namespace Tensorflow.Keras.Engine | |||
| public partial class Model | |||
| { | |||
| /// <summary> | |||
| /// Returns the loss value & metrics values for the model in test mode. | |||
| /// Returns the loss value and metrics values for the model in test mode. | |||
| /// </summary> | |||
| /// <param name="x"></param> | |||
| /// <param name="y"></param> | |||
| @@ -29,7 +29,9 @@ namespace Tensorflow.Keras.Engine | |||
| /// <summary> | |||
| /// The logic for one training step. | |||
| /// </summary> | |||
| /// <param name="data"></param> | |||
| /// <param name="data_handler"></param> | |||
| /// <param name="x"></param> | |||
| /// <param name="y"></param> | |||
| /// <returns></returns> | |||
| Dictionary<string, float> train_step(DataHandler data_handler, Tensors x, Tensors y) | |||
| { | |||
| @@ -72,8 +72,8 @@ namespace Tensorflow.Keras | |||
| /// <summary> | |||
| /// `Model` groups layers into an object with training and inference features. | |||
| /// </summary> | |||
| /// <param name="input"></param> | |||
| /// <param name="output"></param> | |||
| /// <param name="inputs"></param> | |||
| /// <param name="outputs"></param> | |||
| /// <returns></returns> | |||
| public IModel Model(Tensors inputs, Tensors outputs, string name = null) | |||
| => new Functional(inputs, outputs, name: name); | |||
| @@ -1,24 +1,18 @@ | |||
| using Tensorflow.Keras.Engine; | |||
| using Tensorflow.Keras.ArgsDefinition; | |||
| using static Tensorflow.Binding; | |||
| using static Tensorflow.KerasApi; | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using Tensorflow.Keras.Saving; | |||
| using Tensorflow.Common.Types; | |||
| /// <summary> | |||
| /// Base class for attention layers that can be used in sequence DNN/CNN models. | |||
| ///This file follows the terminology of https://arxiv.org/abs/1706.03762 Figure 2. | |||
| ///Attention is formed by three tensors: Query, Key and Value. | |||
| /// </summary> | |||
| namespace Tensorflow.Keras.Layers | |||
| { | |||
| /// <summary> | |||
| /// Base Attention class for Dense networks. | |||
| /// This file follows the terminology of https://arxiv.org/abs/1706.03762 Figure 2. | |||
| /// Attention is formed by three tensors: Query, Key and Value. | |||
| /// This class is suitable for Dense or CNN networks, and not for RNN networks. | |||
| /// Implementations of attention mechanisms should inherit from this class, and | |||
| /// reuse the `apply_attention_scores()` method. | |||
| @@ -183,9 +183,6 @@ namespace Tensorflow.Keras.Layers | |||
| /// <param name="use_bias">Boolean, whether the layer uses a bias vector.</param> | |||
| /// <param name="kernel_initializer">The name of the initializer for the kernel weights matrix (see keras.initializers).</param> | |||
| /// <param name="bias_initializer">The name of the initializer for the bias vector (see keras.initializers).</param> | |||
| /// <param name="kernel_regularizer">The name of the regularizer function applied to the kernel weights matrix (see keras.regularizers).</param> | |||
| /// <param name="bias_regularizer">The name of the regularizer function applied to the bias vector (see keras.regularizers).</param> | |||
| /// <param name="activity_regularizer">The name of the regularizer function applied to the output of the layer (its "activation") (see keras.regularizers).</param> | |||
| /// <returns>A tensor of rank 4+ representing activation(conv2d(inputs, kernel) + bias).</returns> | |||
| public ILayer Conv2D(int filters, | |||
| Shape kernel_size = null, | |||
| @@ -2,7 +2,6 @@ | |||
| using Tensorflow.Keras.Engine; | |||
| using Tensorflow.Keras.Saving; | |||
| using Tensorflow.Common.Types; | |||
| using Tensorflow.Common.Types; | |||
| namespace Tensorflow.Keras.Layers.Reshaping | |||
| { | |||
| @@ -242,10 +242,9 @@ namespace Tensorflow.Keras.Layers.Rnn | |||
| /// | |||
| /// </summary> | |||
| /// <param name="inputs"></param> | |||
| /// <param name="mask">Binary tensor of shape [batch_size, timesteps] indicating whether a given timestep should be masked</param> | |||
| /// <param name="training"></param> | |||
| /// <param name="initial_state">List of initial state tensors to be passed to the first call of the cell</param> | |||
| /// <param name="constants">List of constant tensors to be passed to the cell at each timestep</param> | |||
| /// <param name="training"></param> | |||
| /// <param name="optional_args"></param> | |||
| /// <returns></returns> | |||
| /// <exception cref="ValueError"></exception> | |||
| /// <exception cref="NotImplementedException"></exception> | |||
| @@ -6,7 +6,7 @@ namespace Tensorflow.Keras.Preprocessings | |||
| public partial class DatasetUtils | |||
| { | |||
| /// <summary> | |||
| /// Potentially restict samples & labels to a training or validation split. | |||
| /// Potentially restict samples and labels to a training or validation split. | |||
| /// </summary> | |||
| /// <param name="samples"></param> | |||
| /// <param name="labels"></param> | |||
| @@ -693,7 +693,6 @@ namespace Tensorflow.Keras.Saving | |||
| /// Infers input shape of layer from SavedModel functions. | |||
| /// </summary> | |||
| /// <param name="layer_node_id"></param> | |||
| /// <param name="convert_to_shapes"></param> | |||
| /// <returns></returns> | |||
| private TensorSpec _infer_inputs(int layer_node_id) | |||
| { | |||
| @@ -7,7 +7,7 @@ | |||
| <Nullable>enable</Nullable> | |||
| <RootNamespace>Tensorflow.Keras</RootNamespace> | |||
| <Platforms>AnyCPU;x64</Platforms> | |||
| <Version>0.11.1</Version> | |||
| <Version>0.11.2</Version> | |||
| <Authors>Haiping Chen</Authors> | |||
| <Product>Keras for .NET</Product> | |||
| <Copyright>Apache 2.0, Haiping Chen 2023</Copyright> | |||
| @@ -26,7 +26,8 @@ | |||
| * Add Subtract layer | |||
| * Text preprocessing | |||
| * Preprocessing.timeseries_dataset_from_array | |||
| * Fixed memory leak for YOLOv3 model.</PackageReleaseNotes> | |||
| * Fixed memory leak for YOLOv3 model. | |||
| * Support RNN and LSTM models</PackageReleaseNotes> | |||
| <Description>Keras for .NET | |||
| Keras is an API designed for human beings, not machines. Keras follows best practices for reducing cognitive load: it offers consistent & simple APIs, it minimizes the number of user actions required for common use cases, and it provides clear & actionable error messages.</Description> | |||
| @@ -36,10 +37,10 @@ Keras is an API designed for human beings, not machines. Keras follows best prac | |||
| <PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance> | |||
| <PackageOutputPath>packages</PackageOutputPath> | |||
| <RepositoryType>Git</RepositoryType> | |||
| <SignAssembly>true</SignAssembly> | |||
| <SignAssembly>False</SignAssembly> | |||
| <AssemblyOriginatorKeyFile>Open.snk</AssemblyOriginatorKeyFile> | |||
| <AssemblyVersion>0.11.1.0</AssemblyVersion> | |||
| <FileVersion>0.11.1.0</FileVersion> | |||
| <AssemblyVersion>0.11.2.0</AssemblyVersion> | |||
| <FileVersion>0.11.2.0</FileVersion> | |||
| <PackageLicenseFile>LICENSE</PackageLicenseFile> | |||
| <Configurations>Debug;Release;GPU</Configurations> | |||
| </PropertyGroup> | |||
| @@ -70,6 +71,74 @@ Keras is an API designed for human beings, not machines. Keras follows best prac | |||
| <DefineConstants /> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netstandard2.0|AnyCPU'"> | |||
| <Optimize>True</Optimize> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1573,1591,1712,8602,8603,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0|AnyCPU'"> | |||
| <Optimize>True</Optimize> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1573,1591,1712,8602,8603,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netstandard2.0|x64'"> | |||
| <Optimize>True</Optimize> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1573,1591,1712,8602,8603,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0|x64'"> | |||
| <Optimize>True</Optimize> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1573,1591,1712,8602,8603,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.0|AnyCPU'"> | |||
| <Optimize>False</Optimize> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1573,1591,1712,8602,8603,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0|AnyCPU'"> | |||
| <Optimize>False</Optimize> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1573,1591,1712,8602,8603,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.0|x64'"> | |||
| <Optimize>False</Optimize> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1573,1591,1712,8602,8603,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0|x64'"> | |||
| <Optimize>False</Optimize> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1573,1591,1712,8602,8603,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='GPU|netstandard2.0|AnyCPU'"> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1573,1591,1712,8602,8603,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='GPU|netstandard2.0|x64'"> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1573,1591,1712,8602,8603,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='GPU|net6.0|AnyCPU'"> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1573,1591,1712,8602,8603,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='GPU|net6.0|x64'"> | |||
| <WarningLevel>1</WarningLevel> | |||
| <NoWarn>$(NoWarn),1573,1591,1712,8602,8603,8625,CS0612</NoWarn> | |||
| </PropertyGroup> | |||
| <ItemGroup> | |||
| <PackageReference Include="HDF5-CSharp" Version="1.17.0" /> | |||
| <PackageReference Include="MethodBoundaryAspect.Fody" Version="2.0.148" /> | |||