tfm.vision.augment.to_4d

Converts an input Tensor to 4 dimensions.

4D image => [N, H, W, C] or [N, C, H, W] 3D image => [1, H, W, C] or [1, C, H, W] 2D image => [1, H, W, 1]

image The 2/3/4D input tensor.

A 4D image tensor.

TypeError if image is not a 2/3/4D tensor.