spandrel.ImageModelDescriptor

Takes a single image tensor as input and returns a single image tensor as output.

The image tensor must be a 4D tensor with shape (1, input_channels, H, W). The data type (float32, float16, bfloat16) and device of the image tensor must be the same as the model. The range of the image tensor must be [0, 1].

The output tensor will be a 4D tensor with shape (1, output_channels, H*scale, W*scale). The data type and device of the output tensor will be the same as the image tensor. The range of the output tensor will be [0, 1].

If the width and height of the image tensor do not satisfy the size_requirements of the model, then the image tensor will be padded to satisfy the requirements. The additional padding will be removed from the output tensor before returning it. If the image already satisfies the requirements, then no padding will be added.