I am using C# with TensorFlow.NET (TensorFlow.Keras).
I want to implement alphazero and I want to create a neural network with multiple outputs.
I could create a model with multiple outputs like:
var model = keras.Model((input), (output1, output2));
However, I do not know how to pass multiple loss function in compile phase and multiple labels in fit phase.
model.compile(
optimizer: keras.optimizers.SGD(1e-3f),
metrics: new string[] { "mse", "accuracy" },
loss: ??????????
);
model.fit(x_train, ?????????????);
In C#, it is not allowed to pass an array as loss nor label, but in Python, it seems that we can use dictionary with curly brackets like:
model.compile(optimizer='sgd',
loss={'output1': 'mean_squared_error', 'output2': 'softmax_cross_entropy_with_logits'},
metrics=['mse','accuracy'])
labels= {'output1': np.array([row['value'] for row in minibatch]),
'output2': np.array([row['AV'] for row in minibatch])}
fit = self.model.fit(x_train, lables)
How can we attain this in C#? Thank you.