mistralrs_vision

Function make_pixel_mask

source
pub fn make_pixel_mask(image: &Tensor, h: usize, w: usize) -> Result<Tensor>
Expand description

Generate pixel mask of shape (c, max_h, max_w). 1 indicates valid pixel, 0 indicates padding.

The input tensor is of shape (c, max_h, max_w) and the output mask is the same shape and represents where pixels are. The mask shape is in the top left corner is passed as h and w.