def slice()

in src/image_gen_aux/preprocessors/teed/teed.py [0:0]


    def slice(self, tensor, slice_shape):
        t_shape = tensor.shape
        img_h, img_w = slice_shape
        if img_w != t_shape[-1] or img_h != t_shape[2]:
            new_tensor = F.interpolate(tensor, size=(img_h, img_w), mode="bicubic", align_corners=False)

        else:
            new_tensor = tensor
        # tensor[..., :height, :width]
        return new_tensor