I am looking for the following:
Assume that I have a trainable tensor T of shape torch.size().
Now I would like to train that tensor but also to have the following constraint:
the tensor sould be symmetric in the sense that
T = T
T = T,
T = T,
T = T.
i.e. the tensor T consists of actually two tensors, one of which is the flipped version of the other one.
I have tried to assign to the first half of T its flipped version, i.e.
self.T[4:] = torch.flip(self.T[:4],dims=)
but this fails as the optimizer tells me the it can’t optimize a non-leaf tensor.
Any ideas on how to make that work?
Thank you very much in advance!