SciSharp / TensorFlow.NET

.NET Standard bindings for Google's TensorFlow for developing, training and deploying Machine Learning models in C# and F#.
https://scisharp.github.io/tensorflow-net-docs
Apache License 2.0
3.23k stars 517 forks source link

[BUG Report]: No _read_only_resource_inputs attr error running model.fit under windows application #1185

Open homer14 opened 1 year ago

homer14 commented 1 year ago

Description

Hello,

When I run my simple model.fit in a C# Console App it runs fine, any verbose level.

var hist = model.fit(X, Y, epochs: 1);

When I use the same exact code and X Y inputs, but under a Windows Application, inside of an object it throws the following error during the model.fit.

Tensorflow.InvalidArgumentError: 'Operation 'lstm_cell/ReadVariableOp' has no attr named '_read_only_resource_inputs'.'

Reproduction Steps

Make a working model of type Sequential in a Console App where model.fit runs without error.

Copy that code into an object of a Windows App.

Instantiate the windows object ( e.g., OBJ o = new OBJ(); )

Call a method on the object to run the code copied from the Console App (e.g., o.MakeModel(); )

the model.fit throws an error.

Known Workarounds

No response

Configuration and Other Information

.NET 7

scishartp.tensorflow.redist 2.11.4 tensorflow.keras 0.11.4 tensorflow.net 0.110.4

I've tried a few other versions and no change. Same error. Is it possible that it is Task related? I've tried running it with awaited tasks, non awaited tasks, various forms of running a Task, or not.

Is it possible it needs the output window during fit and that's not available in the Windows App?

homer14 commented 11 months ago

update: you can continue to run the model fit if you ignore the exceptions in the tensorlow.binding.dll . the difference in the console app and windows app in my case was that the windows app had breaking on all exceptions enabled.