I found the solution. I need to specify the self.const as parameters.
import torch
import torch.utils.data
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
import sys
import numpy as np

class Test(nn.Module):
    def __init__(self):
        super(Test, self).__init__()
        self.const = nn.Parameter(torch.from_numpy(np.zeros((5,5),dtype=np.float32)), requires_grad=False)

    def forward(self, x, y):
        bat = x.size(0)
        return self.const.unsqueeze(0).expand(bat, 5, 5)+x+y

model=Test()
model = torch.nn.DataParallel(model, device_ids=range(int(sys.argv[1])))
model = model.cuda()
inp1  = Variable(torch.from_numpy(np.ones((6,5,5),dtype=np.float32))).cuda()
inp2  = Variable(torch.from_numpy(np.ones((6,5,5),dtype=np.float32))).cuda()
print inp1
print model(inp1, inp2)