MCPcopy Create free account
hub / github.com/VisionXLab/OF-Diff / cubic

Function cubic

ldm/modules/image_degradation/utils_image.py:700–705  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

698
699# matlab 'imresize' function, now only support 'bicubic'
700def cubic(x):
701 absx = torch.abs(x)
702 absx2 = absx**2
703 absx3 = absx**3
704 return (1.5*absx3 - 2.5*absx2 + 1) * ((absx <= 1).type_as(absx)) + \
705 (-0.5*absx3 + 2.5*absx2 - 4*absx + 2) * (((absx > 1)*(absx <= 2)).type_as(absx))
706
707
708def calculate_weights_indices(in_length, out_length, scale, kernel, kernel_width, antialiasing):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected