How to define Deep Q learning loss function in Knet?

I’am trying to implement a Deep Q learning loss function as part of my thesis. I’m trying to use Knet but I can’t find a simple example.

I’m not familiar with knet, but here’s at least a Julia implementation of Q learning with linear function approximation
https://sites.google.com/view/recreational-research/q-learning

Here is an example with Flux, but I think it should be possible to simply replace the Flux-neural-net by a Knet-neural-net.