I’m unsure how this assignment would be possible, as the desired shapes would be different:



 m.hassanin:

That is, B[:,0,:] has values of A[1:5,:]


Example:
A = torch.randn(10, 1, 4)
print(A[1:5].shape)
> torch.Size([4, 1, 4])

B = torch.randn(10, 5, 4)
B[:, 1:5, :].shape
> torch.Size([10, 4, 4])

As you can see, the slice in A contains 16 elements while the slice in B contains 160 elements.
Could you post an example how B should be filled?
I think you might be able to use A.unfold, but of course the shape mismatch should be solved first.