torch.Tensor.Tensor.unsqueeze_
Tensor.unsqueeze_(dim: number): thisTensor.unsqueeze_(options: UnsqueezeOptions): thisInserts a dimension of size one at the specified position in-place.
Parameters
dimnumber- Position where the dimension should be inserted
Returns
this– This tensor with the new dimensionExamples
const x = torch.zeros(3, 4);
x.unsqueeze_(0); // Now shape is [1, 3, 4]