Is there a different “resizeAs” in PyTorch?
AttributeError: 'Variable' object has no attribute 'resizeAs_'
The error comes from this code:
class ContentLoss(nn.Module):

    def __init__(self, target, strength):
        super(ContentLoss, self).__init__()
        self.target = target.detach() * strength
        self.strength = strength
        self.crit = nn.MSELoss()
        self.register_parameter('loss_mode', None)
	    self.normalize = 'Yes'
		
		
    def forward(self, input):
      #self.output = input.clone()
	  if self.loss_mode is None:
	    self.target.resizeAs_(input).clone(input)
	  else: 
	    self.loss = self.crit(self.G, self.target) * self.strength       
	  self.output = input 
      return self.output

    def backward(self, input, gradOutput):
	  if self.loss_mode is None:
        self.gradInput.resizeAs_(gradOutput).clone(gradOutput)

	  else:
	    if input.data.nelement() == self.target.nelement():
	      self.gradInput = self.crit(input, self.target)
	    if self.normalize == 'Yes':
	      self.gradInput.div_(torch.norm(self.gradInput, 1) + 1e-8) # Normalize Gradients
	    self.gradInput.mul_(self.strength)
        self.gradInput.add_(gradOutput)

		  
        #self.loss.backward(retain_graph=retain_graph)
      return self.gradInput