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

Method __init__

ram/utils/diffjpeg.py:125–132  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

123 """
124
125 def __init__(self):
126 super(DCT8x8, self).__init__()
127 tensor = np.zeros((8, 8, 8, 8), dtype=np.float32)
128 for x, y, u, v in itertools.product(range(8), repeat=4):
129 tensor[x, y, u, v] = np.cos((2 * x + 1) * u * np.pi / 16) * np.cos((2 * y + 1) * v * np.pi / 16)
130 alpha = np.array([1. / np.sqrt(2)] + [1] * 7)
131 self.tensor = nn.Parameter(torch.from_numpy(tensor).float())
132 self.scale = nn.Parameter(torch.from_numpy(np.outer(alpha, alpha) * 0.25).float())
133
134 def forward(self, image):
135 """

Callers 14

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected