TALNet: Use batch size as sample_size
TALNet: Use batch size as sample_size

Summary:
`Wav2VecCriterion` uses a sample_size for two purposes:
1. It weights the extra loss by multiplying it by sample_size;
2. It divides the total loss by sample_size before reporting them in the learning curves.

By default, when using the binary cross-entropy loss (`infonce = False`), `Wav2VecCriterion` uses the number of 1's in the label matrix as sample_size.
For TALNet, because each recording may have multiple labels, this sample_size is not a constant across batches.
TALNet also uses a consistency loss between the predictions on two different copies of augmented data as an extra loss, and it is undesirable for the weight of the extra loss to vary from batch to batch.

This diff adds a field "sample_size" to the batch in the `AcousticEventCollater`, and makes it equal to the batch size (number or recordings in a batch).
Because the extra loss is multiplied by sample_size in `Wav2VecCriterion`, this diff also divides the consistency loss by the batch size in the `forward` method of `TALNetModel`.

This diff also adds a unit test for the consistency loss.

Reviewed By: alexeib

Differential Revision: D28728699

fbshipit-source-id: dda1f2a1b02e49b894842c8990218b5fe92d0330

pytorch/fairseq,pytorch/fairseq,pytorch/fairseq