Forward-only Function

Ok after trying a few things.

  1. In order to make sure func would not be included in the Autograd graph, I all had to do was to pass x.data to it instead of x:

    loss_y = second_loss(func(x.data), y)

This way I won’t have to think if I should return None for it backward or not, backward will simply not be called by autograd.

  1. It is Ok if we only bind forward for a cuda extension, it works just fine