Hi,
This looks fairly good, a few small things:


async=True for the target is most likely useless here (unless you specifically put it in pinned memory) so you can remote it
Variables don’t exist anymore, you can remove input_var = torch.autograd.Variable(input) and just use input where you have input_var. Same for the target.
Replace output.data with output.detach() that is the new way to do it. It works nicely with the autograd engine and will detect some forbidden behavior that the old .data was not able to do.