Hi Alex, so many thanks for your patience.
The question is, I do want to make a compact data copy as this will incur memory cost. I only want to release the data region where I do want to use.
I make a possible solution. If I only want x[…, ::2] data, I can assign it to:
x[…, :2] = x[…, ::2]
Then, I may use the resize_ method:
x.resize_(2,3,2)
With this, there is no extra memory cost to maintain a part of the tensor.
Could you think this way is good, or other better solution?
Thank you.