This is because you are trying to call avg by passing in a value of 0. I think you wanted to do an access (i.e. avg[0] on it instead? Even so I don’t think the tensors y and avg[0] wouldn’t match here …?