TadGAN with lightning

Hi,

I’m trying to implement the TadGAN model for time series anomaly detection with lighting and I find it really difficult. The issue is this training loop:

for epoch in range(n_epochs):
logging.debug(‘Epoch {}’.format(epoch))
n_critics = 5

    cx_nc_loss = list()
    cz_nc_loss = list()

    for i in range(n_critics):
        cx_loss = list()
        cz_loss = list()

        for batch, sample in enumerate(train_loader):
            loss = critic_x_iteration(sample)
            cx_loss.append(loss)

            loss = critic_z_iteration(sample)
            cz_loss.append(loss)

    for batch, sample in enumerate(train_loader):
        enc_loss = encoder_iteration(sample)
        dec_loss = decoder_iteration(sample)
        encoder_loss.append(enc_loss)
        decoder_loss.append(dec_loss)

How I implement it within training_step with the extra loop “for i in range(n_critics) ?”

Thanks a lot,
Roberto