#C14507. GAN Training Loss Summation

    ID: 44164 Type: Default 1000ms 256MiB

GAN Training Loss Summation

GAN Training Loss Summation

In this problem, you are given logs extracted from the training process of a Generative Adversarial Network (GAN). Each log entry follows the format:

[epoch/num_epochs][iteration/total_iterations] Loss_D: X Loss_G: Y

Here, X and Y are floating-point numbers representing the discriminator loss and generator loss, respectively. Your task is to read the log entries from standard input and, for each entry, compute the sum of the losses (i.e. Loss_D + Loss_G). Output the resulting sum on a new line for each entry, formatted to exactly four decimal places.

The formula for the summation is given by:

S=X+YS = X + Y

where ( X ) is the discriminator loss and ( Y ) is the generator loss.

inputFormat

The first line of input contains an integer ( N ) representing the number of log entries. This is followed by ( N ) lines, each representing a log entry in the following format:

[epoch/num_epochs][iteration/total_iterations] Loss_D: X Loss_G: Y

For example:

[1/25][3/100] Loss_D: 0.5000 Loss_G: 0.6000

outputFormat

For each log entry, output a line containing the sum ( S = X + Y ) rounded and formatted to four decimal places.## sample

1
[1/25][1/100] Loss_D: 0.2345 Loss_G: 0.6789
0.9134

</p>