try below to find whether the problem comes from input , model or criterion.
    optimizer.zero_grad()
    print(input_var.volatile)
    output = model.forward(x=input_var)
    print(output.volatile)
    loss = criterion(output, target_var)
    print(loss.volatile)
    loss.backward()