Hi everyone,
I’ve tried to set up an vae for audio files, but I get the error input size should be between 0 and 1 when using the binary_cross_entropy() function, even though I didn’t have any of these issues when testing with MNIST Image files.
I suspect the error to result from the following function:
def reparameterize(self, mu, logvar):
    if self.training:
        std = logvar.mul(0.5).exp_()  
        eps = Variable(std.data.new(std.size()).normal_())
        return eps.mul(std).add_(mu)

because that’s where any of my data starts to be out of the 0 to 1 range in the whole code. the processing continues as follows:
*def forward(self, x, sampleCount):*



   x = x.view(1,1,sampleCount).float()                                         #Reshape the audio data to fit Conv*



   mu, logvar = self.encode(x)*
  z = self.reparameterize(mu, logvar)
  return z, mu, logvar



next is the loss function, which causes the error:
BCE = F.binary_cross_entropy(z.view(-1, sampleCount), x.view(-1, sampleCount).float())
can anyone please help me?
I’ve already tried using binary_cross_entropy_with_logits which didn’t crash my code, but yield any useable results.
Thanks