How can I check if two models are identical?

I want to pass a model to my function but I am not sure whether the parameters will be identical and all the updates will be updated (weights, bias, gradient, etc).
How can I check and do you suggest using the model as a global parameter or pass it to the function and then return it?

def batch_creator(features_train, labels_train, batch):
  modela.train()
  for batch_idx, (inpts, targts) in enumerate(zip(features_train, labels_train)):
    #iterate to get batch
    print('Batch: ',batch_idx+1)
    if batch_idx+1 == batch:
      inputs = inpts
      targets = targts
      break
  #create data to feed in LSTM    
  for video_idx, video in enumerate(inputs):
    print('Video: ',video_idx+1)
    samples = []
    for frame in video:
      #print(torch.unsqueeze(frame.to(device).type(torch.cuda.FloatTensor),0).shape)
      feature = modela(torch.unsqueeze(frame.to(device).type(torch.cuda.FloatTensor),0))
      samples.append(feature) #40x25088
      del feature
  return samples, targets    

(I am using the above function and I try to manage my available GPU ram)
I believe using the model as a global variable will make sure that I wont have to worry about any changes not being updated in the model (though for now I don’t optimise the model)