But if you don’t want to bother with ignite I guess you could also do this:
global epoch, prev_epoch

def tricky_hook_for_recording_epoch(module, input, output):
    if epoch > prev_epoch:
        # TensorBoard stats, logging, etc
        prev_epoch = epoch

my_model = some_net()
my_model.specific_layer.register_forward_hook(tricky_hook_for_recording_epoch)
prev_epoch = 0
for epoch in range(epoch_size):
    for i, (data, label) in enumerate(dataloader):
        output = my_model(data)