It seems op is the “training operation”, e.g. op = tf.train.AdamOptimizer().minimize(var).
Using PyTorch you can just perform a training step:
...
output = model(data)
loss = criterion(output, target)
loss.backward()
optimizer.step()

Does this help?