I’ve reimplemented a toy example from this blog post 103 a while ago and you can find the code here 106.
Since this code is quite old by now, you might need to change some details (e.g. swap data[0] for .item()).