I tried to copy several tensors (a batch of tensors) to one single tensor, but I got the next error:
raise RuntimeError("Only Tensors created explicitly by the user "
RuntimeError: Only Tensors created explicitly by the user (graph leaves) support the deepcopy protocol at the moment
Any idea how to copy/transfer a batch of tensors to the single 4D tensor?
I have attached my code:
class GLr(nn.Module):
def __init__(self, shape):
    super(GL, self).__init__()

    assert len(shape) == 4, " Invalid argument: shape must be tuple of fourth"
    self.layers = nn.Parameter(data=torch.Tensor(shape), requires_grad=True)
    self.temp_holder = torch.rand(shape)

def forward(self, images):

    for i, image_ in enumerate(images):
        for j, image in enumerate(image_):
            self.temp_holder[i][j] = self.kernel_fn( .... )
    self.layers.data = copy.deepcopy(self.temp_holder)
    return self.layers