MCPcopy Create free account
hub / github.com/apple/ml-sharp / create_alignment

Function create_alignment

src/sharp/models/alignment.py:22–40  ·  view source on GitHub ↗

Create depth alignment.

(
    params: AlignmentParams, depth_decoder_dim: int | None = None
)

Source from the content-addressed store, hash-verified

20
21
22def create_alignment(
23 params: AlignmentParams, depth_decoder_dim: int | None = None
24) -> nn.Module | None:
25 """Create depth alignment."""
26 if depth_decoder_dim is None:
27 raise ValueError("Requires depth_decoder_dim for LearnedAlignment.")
28 alignment = LearnedAlignment(
29 depth_decoder_features=params.depth_decoder_features,
30 depth_decoder_dim=depth_decoder_dim,
31 steps=params.steps,
32 stride=params.stride,
33 base_width=params.base_width,
34 activation_type=params.activation_type,
35 )
36
37 if params.frozen:
38 alignment.requires_grad_(False)
39
40 return alignment
41
42
43class LearnedAlignment(nn.Module):

Callers 1

create_predictorFunction · 0.85

Calls 1

LearnedAlignmentClass · 0.85

Tested by

no test coverage detected