MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / make_axial_pos

Function make_axial_pos

k_diffusion/models/axial_rope.py:60–68  ·  view source on GitHub ↗
(h, w, pixel_aspect_ratio=1.0, align_corners=False, dtype=None, device=None)

Source from the content-addressed store, hash-verified

58
59
60def make_axial_pos(h, w, pixel_aspect_ratio=1.0, align_corners=False, dtype=None, device=None):
61 y_min, y_max, x_min, x_max = bounding_box(h, w, pixel_aspect_ratio)
62 if align_corners:
63 h_pos = torch.linspace(y_min, y_max, h, dtype=dtype, device=device)
64 w_pos = torch.linspace(x_min, x_max, w, dtype=dtype, device=device)
65 else:
66 h_pos = centers(y_min, y_max, h, dtype=dtype, device=device)
67 w_pos = centers(x_min, x_max, w, dtype=dtype, device=device)
68 return make_grid(h_pos, w_pos)
69
70
71def freqs_pixel(max_freq=10.0):

Callers 1

forwardMethod · 0.85

Calls 3

bounding_boxFunction · 0.85
centersFunction · 0.85
make_gridFunction · 0.85

Tested by

no test coverage detected