(x)
| 698 | |
| 699 | # matlab 'imresize' function, now only support 'bicubic' |
| 700 | def 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 | |
| 708 | def calculate_weights_indices(in_length, out_length, scale, kernel, kernel_width, antialiasing): |
no outgoing calls
no test coverage detected