it solved without specifying a device
import loss_landscapes
import loss_landscapes.metrics

x, y = next(iter(testLoader))

# if haveCuda:
#   x,y = x.cuda(), y.cuda()

metric = loss_landscapes.metrics.Loss(criterion, x, y)

# compute loss data
loss_data = loss_landscapes.linear_interpolation(
    model_initial.cpu(), 
    model_final.cpu(), 
    metric, 
    40, 
    deepcopy_model=True
)