官方教程链接: CREATING EXTENSIONS USING NUMPY AND SCIPY
该教程主要有两个任务:
使用 NumPy 实现无参数的网络
使用 SciPy 实现有参数的网络
使用...NumPy 实现无参数的网络
下面使用的这层网络没有做任何有用的或者数学上正确的计算,所以被称为 BadFFTFunction。...def incorrect_fft(input):
return BadFFTFunction()(input)
下面是使用该网络层的例子:
inputs = torch.randn(8, 8,...0.5269, -0.5503, 0.2355, -0.2890, 0.0305, -0.4156, 1.0513, 0.2139]],
requires_grad=True)
使用...def forward(self, input):
return ScipyConv2dFunction.apply(input, self.filter, self.bias)
下面是使用该网络层的例子