MCPcopy Create free account
hub / github.com/DragonisCV/RAM / cubic

Function cubic

ram/utils/matlab_functions.py:6–13  ·  view source on GitHub ↗

cubic function used for calculate_weights_indices.

(x)

Source from the content-addressed store, hash-verified

4
5
6def cubic(x):
7 """cubic function used for calculate_weights_indices."""
8 absx = torch.abs(x)
9 absx2 = absx**2
10 absx3 = absx**3
11 return (1.5 * absx3 - 2.5 * absx2 + 1) * (
12 (absx <= 1).type_as(absx)) + (-0.5 * absx3 + 2.5 * absx2 - 4 * absx + 2) * (((absx > 1) *
13 (absx <= 2)).type_as(absx))
14
15
16def calculate_weights_indices(in_length, out_length, scale, kernel, kernel_width, antialiasing):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected