but if I comment the definition of backward function, then it sends me the error message "  raise NotImplementedError
NotImplementedError"
the following is my code
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.autograd import Function

class Gaussian(Function):
    @staticmethod
    def forward(self,input,sigma,center):
        dist1=center-input
        self.dist1=dist1
        dist=torch.pow(dist1,2)
        dist2=torch.sum(dist,1)
        self.dist2=dist2
        sigma2=torch.pow(sigma,2)
        self.sigma2=sigma2
        dist=-1/2*sigma2*dist2
        output=torch.exp(dist)
        self.save_for_backward(input,sigma,center,output)
        return output
    
    """
    @staticmethod
    def backward(self,grad_output):
        input,sigma,center,output=self.saved_variables
        grad_input=grad_sigma=grad_center=None
        if self.needs_input_grad[0]:
            tmp=grad_output*output*self.sigma2
            grad_input=torch.mv(center.t(),tmp)
        if self.needs_input_grad[1]:
            grad_sigma=-grad_output*output*sigma*self.dist2
            
        if self.needs_input_grad[2]:
            tmp = -grad_output*output*self.sigma2
            tmp = torch.diag(tmp)
            grad_center = torch.mm(tmp,self.dist1)
            
        return grad_input,grad_sigma,grad_center
"""  
from torch.autograd import gradcheck
input =(Variable(torch.randn(10).double(), requires_grad=True), Variable(torch.randn(20).double(), requires_grad=True),
        Variable(torch.randn(20,10).double(), requires_grad=True))
test = gradcheck(Gaussian.apply, input, eps=1e-6, atol=1e-4)
print(test)