squeeze(): Removing Singleton Dimensions
squeeze() removes dimensions of length one from an array or matrix. It makes data easier to work with after slicing or importing a shape such as 1×n×1.
Shape changes
squeeze changes dimensions but not the stored values. Inspect before and after with size(). Use reshape() when you need a specific target shape rather than automatic removal.
Be careful when a singleton dimension carries meaning, such as a batch or channel axis. Use subset() for deliberate selection and transpose() when orientation matters.