0

`nuget package:

TensorFlow.NET 0.110.2

TensorFlow.Keras 0.11.2

SciSharp.TensorFlow.Redist-Windows-GPU 2.10.3`

var layers = keras.layers;
List<ILayer> layerList = new List<ILayer>()
{
    layers.InputLayer(input_shape: new Shape(AITrainDataConfig.WindowSize, AITrainDataConfig.FeatureCount)),
    layers.LSTM(units: 1024, return_sequences: true),
    layers.LSTM(units: 1024, return_sequences: true),
    layers.Dropout(0.2f),
    layers.LSTM(units: 768,return_sequences:true),
    layers.LSTM(units: 768,return_sequences:true),
    layers.Dropout(0.2f),
    layers.LSTM(units: 512,return_sequences:true),
    layers.LSTM(units: 512,return_sequences:false),
    layers.Dropout(0.2f),
    layers.Dense(256),
    layers.Dense(1),
};

Sequential model = keras.Sequential(layers: layerList);
tf.compat.v1.disable_eager_execution();

model.compile(tf.keras.optimizers.Adam(), tf.keras.losses.MeanSquaredError());
model.summary();
List<ICallback> callbackList = new List<ICallback>()
{
    new EarlyStopping(new() { }, monitor: "val_loss", mode: "min", verbose: 1, patience: 3),
};

model.fit(trainInputRawData, trainOutputRawData,
    epochs: 1000,
    batch_size: 512,
    verbose: 1,
    validation_data: new(validateInputRawData, validateOutputRawData),
    callbacks: callbackList);

trainInputRawData and validateInputRawData is float[,,]

trainOutputRawData and validateOutputRawData is float[]

Tensorflow.Exceptions.NotOkStatusException: 'Cast int64 to resource is not supported [[{{node Read/ReadVariableOp/resource}}]]'

model.fit throw exception as title.

TensorFlow console log

I never use "long" in this program, so I don't understand this message mean. please help me. thx.

YJFu
  • 1
  • 3
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jul 23 '23 at 20:02

0 Answers0