SciSharp/TensorFlow.NET

Namespace and Compilation Errors with TensorFlow.NET

Opened this issue · 1 comments

Description

Hello,

I'm using TensorFlow.NET for a machine learning project and facing issues with namespaces and compilation errors. Here’s a brief overview:

Environment:

  • TensorFlow.NET version: (specify your version)
  • IDE: Visual Studio 2019
  • OS: Windows 10

Problem:
I get several CS0246 errors stating that namespaces like Tensorflow.Keras.Optimizers and classes such as Adam, Dense, and LSTM cannot be found.

Code Snippet:

var model = new Sequential();
model.add(new LSTM(50, activation: "relu", input_shape: new Shape(1, 10)));
model.add(new Dense(1, activation: "sigmoid"));
model.compile(new Adam(), loss: "binary_crossentropy", metrics: new[] { "accuracy" });
Attempted Solutions:

Reinstalled TensorFlow.NET via NuGet.
Searched for namespace changes in the documentation and issues.
Could someone help me understand if there are recent changes to namespaces in TensorFlow.NET or provide guidance on how to fix these errors?

Thank you.

### Reproduction Steps

_No response_

### Known Workarounds

_No response_

### Configuration and Other Information

_No response_

It seems you've installed Tensorflow.NET but not Tensorflow.Keras; that's why you get these errors. You only need to install Tensorflow.Keras (and the Redistribution package).