I’m trying to replicate a NumPy function from here: https://github.com/google/deepdream/blob/master/dream.ipynb 10
From the link, the code is: “trying to maximize the dot-products between activations of current image, and their best matching correspondences from the guide image.”
When I run the following code, or any variation that has torch.mm(x.T, y), I get a out of memory error:
def guide_output(input, guide):
    x = input.squeeze(0)
    y = guide.squeeze(0)
    ch = x.shape[0]
    x = x.reshape(ch,-1)
    y = y.reshape(ch,-1)
    A = torch.mm(x.T, y) # compute the matrix of dot-products with guide features
    x.reshape(ch,-1)[:] = y[:,A.argmax(1)] # select ones that match best

input = torch.randn(3,512,512).unsqueeze(0)
guide = torch.randn(3,512,512).unsqueeze(0)
output = guide_output(input, guide)

The error message:
Traceback (most recent call last):
  File "test.py", line 76, in <module>
    output = guide_output(input, guide)
  File "test.py", line 63, in guide_output
    A = torch.mm(x.T, y) # compute the matrix of dot-products with guide features
RuntimeError: [enforce fail at ..\c10\core\CPUAllocator.cpp:72] data. DefaultCPUAllocator: not enough memory: you tried to allocate 274877906944 bytes. Buy new RAM!