Head utils
Permute
¶
Bases: Module
nn.Module wrapper around Tensor.permute for cleaner nn.Sequential usage.
Source code in inference/models/depth_anything_v3/architecture/head_utils.py
22 23 24 25 26 27 28 29 30 31 32 | |
create_uv_grid(width, height, aspect_ratio=None, dtype=None, device=None)
¶
Create a normalized UV grid of shape (width, height, 2).
Source code in inference/models/depth_anything_v3/architecture/head_utils.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
custom_interpolate(x, size=None, scale_factor=None, mode='bilinear', align_corners=True)
¶
Safe interpolation implementation to avoid INT_MAX overflow.
Source code in inference/models/depth_anything_v3/architecture/head_utils.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
make_sincos_pos_embed(embed_dim, pos, omega_0=100)
¶
Generate 1D positional embedding from a given grid using sine and cosine functions.
Source code in inference/models/depth_anything_v3/architecture/head_utils.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
position_grid_to_embed(pos_grid, embed_dim, omega_0=100)
¶
Convert 2D position grid (HxWx2) to sinusoidal embeddings (HxWxC)
Source code in inference/models/depth_anything_v3/architecture/head_utils.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |