I am trying to do something like this:
def forward(self, x):
x = self.conv1(x)
x=self.R1(x)
x=self.M1(x)
        layer1_mean=self.mean(x) ##calculate mean
        layer1_var=self.variance(x) ##calculate variance
        new_layer=((torch.zeros(2*batch, 36,1,1).cuda()).float) ##Create new tensor
        
        ## copy to new tensor
        new_layer[0:batch]=layer1_mean
        new_layer[batch:2*batch]=layer1_var

However, I am getting the error : ‘method’ object does not support item assignment
What’s going wrong and how can it be resolved?