IntelLabs / coach

Reinforcement Learning Coach by Intel AI Lab enables easy experimentation with state of the art Reinforcement Learning algorithms
https://intellabs.github.io/coach/
Apache License 2.0
2.32k stars 459 forks source link

[Question] Gated PixelCNN embedder #260

Open redknightlois opened 5 years ago

redknightlois commented 5 years ago

Hi @galleibo-intel and team,

I am trying to create a Gated PixelCNN embedder for images and train it jointly with the RL model. While creating the 'layer' is kinda straightforward, now I face the problem that I have to somehow integrate the loss function into the process.

The loss looks like this:

loss = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(flattened_logits, target_pixels_loss))

You can check for reference the repo https://github.com/jakebelew/gated-pixel-cnn how that looks like.

Is there any way to achieve this on the Coach Framework?

gal-leibovich commented 5 years ago

I think that you can currently (before we move to TF2.0) workaround that, by adding that loss to tensorflow's loss collection, by doing tf.losses.add_loss(...). This interface will be dropped with the move to TF2.0, though, which will happen at some point.