I still got error even I followed your coding, the following is the code and the error message is among it
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 10 10:04:34 2018

@author: apple
"""
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.autograd import Function

class Gaussian(nn.Module):
    def __init__(ctx,in_features,out_features):
        super(Gaussian,ctx).__init__()
        ctx.sigma=nn.Parameter(torch.Tensor(out_features))
        ctx.center=nn.Parameter(torch.Tensor(out_features,in_features))
    def forward(ctx,input):
        dist=ctx.center-input  
"""
sub() received an invalid combination of arguments - got (torch.FloatTensor), but expected one of:
 * (float other, float alpha)
 * (Variable other, float alpha)
"""
        dist=torch.pow(dist,2)
        dist=torch.sum(dist,1)
        sigma=torch.pow(ctx.sigma,2)
        dist=-1/2*sigma*dist
        output=torch.exp(dist)
        return output

class RBF(nn.Module):
    def __init__(ctx,in_features,out_features):
        super(RBF,ctx).__init__()
        ctx.Gaussian1 = Gaussian(in_features,out_features)
    
    def forward(ctx,x):
        return ctx.Gaussian1(x)


def Gaussian_init(m):
    if isinstance(m, Gaussian):
        m.sigma=nn.Parameter(torch.Tensor([3]))
        m.center=nn.Parameter(torch.Tensor([[1,2]]))

model=RBF(2,1)
model.apply(Gaussian_init)

x=torch.Tensor([1,2])
y=model(x)
  


I want to define a new layer Gaussian, and to use that layer to build a net. And I want to apply the Gaussian_init to initiate the parameters in Gaussian