I am somewhat new to using Tensorflow and learn to use it from a C# application. I am trying to convert a simple LSTM Python example ([login to view URL]) that works very well on my machine in Python using the GPU. In my C# implementation, I have hard coded the input data to simplify the process. The data is identical in both the Python example and my code. However, when I try to build it in .NET (Visual Studio 2022), it crashes when the fit() method is encountered. First, the input_shape argument is not available in the LSTM constructor within .NET. So, the obvious thing to do would be to add an InputLayer instead. I have done this in the Python example code and it works fine. However, when I try to use the InputLayer in .NET, I get a completely different error than I am getting below. It seems like something rather screwy is going on that is not easily found in the documentation. I am absolutely baffled and have spent more time on this that virtually any other program error in my past. For the .NET application, I have the following 3 Nuget libraries currently added to the project...
[login to view URL] (0.4.0)
[login to view URL] (0.70.1)
I am including files containing the slightly changed python code (that runs fine) from the online example as well as my C# program code for debugging. Again, here is the link to the online example ([login to view URL]).
Here is the error I get when the fit() method is encountered but I cannot get the InputLayer to work either.
2022-10-02 13:14:20.485908: I tensorflow/core/platform/[login to view URL]] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-10-02 13:14:20.892331: I tensorflow/core/common_runtime/gpu/[login to view URL]] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 9432 MB memory: -> device: 0, name: NVIDIA GeForce RTX 3080 Ti, pci bus id: 0000:0a:00.0, compute capability: 8.6
Unhandled exception. [login to view URL]: Sequence contains no elements
at [login to view URL]()
at Tensorflow.Keras.Engine.Sequential.track_nodes_created_by_last_call(ILayer layer, List`1 created_nodes)
at Tensorflow.Keras.Engine.Sequential._build_graph_network_for_inferred_shape(Shape input_shape, TF_DataType input_dtype)
at [login to view URL](Tensors inputs, Tensor state, Nullable`1 training)
at [login to view URL](Tensors inputs, Tensor state, Boolean training)
at Tensorflow.Keras.Engine.Model.train_step(Tensor x, Tensor y)
at Tensorflow.Keras.Engine.Model.train_step_function(OwnedIterator iterator)
at [login to view URL](Int32 epochs, Int32 verbose)
at [login to view URL](NDArray x, NDArray y, Int32 batch_size, Int32 epochs, Int32 verbose, Single validation_split, Boolean shuffle, Int32 initial_epoch, Int32 max_queue_size, Int32 workers, Boolean use_multiprocessing)
at [login to view URL](String args) in C:\Users\num1\source\repos\LSTM_Test\LSTM_Test\[login to view URL]:line 24