About Variable multiplication in GAN example

Hi !
In the GAN example (https://github.com/pytorch/examples/blob/master/dcgan/main.py),
while training the D-network on fake data:

# train with fake
noise.resize_(batch_size, nz, 1, 1).normal_(0, 1)
noisev = Variable(noise)
fake = netG(noisev)

I want to add the pull-away penalty proposed by [1]. So, I add the following lines:

numerator = fake.view(batch_size,3*32*32) # assume that image size is 3x32x32
norm_fake = numerator*numerator.transpose(0,1)

Here, even though size of numerator is [batchsize, 3072] (I printed the numerator.size()), the size of norm_fake is also [batchsize, 3072] (I expect that it becomes [batchsize, batchsize]). I don’t know what’s wrong…

Is this an issue or there is something that I don’t know about?

Thanks in advance,
Kimin Lee.

[1] Junbo Zhao, Michael Mathieu, and Yann LeCun. Energy-based generative adversarial network.
arXiv preprint arXiv:1609.03126, 2016.

This issue is solved by replacing numerator*numerator.transpose(0,1) with torch.matmul(numerator,numerator.transpose(0,1)).