I fix this by simply adding the @staticmethod decorator to the forward methods of classes that inherit from torch.autograd.Function and then changing the calling of these forward methods to be used via the "apply" function as in the above linked example in the PyTorch docs.
PyTorch error message: RuntimeError: Legacy autograd function with non-static forward method is deprecated. Please use new-style autograd function with static forward method. (Example: https://pytorch.org/docs/stable/autograd.html#torch.autograd.Function)
I fix this by simply adding the @staticmethod decorator to the forward methods of classes that inherit from torch.autograd.Function and then changing the calling of these forward methods to be used via the "apply" function as in the above linked example in the PyTorch docs.