MCPcopy Create free account
hub / github.com/DSL-Lab/StreamSplat / _make_scratch

Function _make_scratch

model/depth_anything/depth_anything_v2/util/blocks.py:4–26  ·  view source on GitHub ↗
(in_shape, out_shape, groups=1, expand=False)

Source from the content-addressed store, hash-verified

2
3
4def _make_scratch(in_shape, out_shape, groups=1, expand=False):
5 scratch = nn.Module()
6
7 out_shape1 = out_shape
8 out_shape2 = out_shape
9 out_shape3 = out_shape
10 if len(in_shape) >= 4:
11 out_shape4 = out_shape
12
13 if expand:
14 out_shape1 = out_shape
15 out_shape2 = out_shape * 2
16 out_shape3 = out_shape * 4
17 if len(in_shape) >= 4:
18 out_shape4 = out_shape * 8
19
20 scratch.layer1_rn = nn.Conv2d(in_shape[0], out_shape1, kernel_size=3, stride=1, padding=1, bias=False, groups=groups)
21 scratch.layer2_rn = nn.Conv2d(in_shape[1], out_shape2, kernel_size=3, stride=1, padding=1, bias=False, groups=groups)
22 scratch.layer3_rn = nn.Conv2d(in_shape[2], out_shape3, kernel_size=3, stride=1, padding=1, bias=False, groups=groups)
23 if len(in_shape) >= 4:
24 scratch.layer4_rn = nn.Conv2d(in_shape[3], out_shape4, kernel_size=3, stride=1, padding=1, bias=False, groups=groups)
25
26 return scratch
27
28
29class ResidualConvUnit(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected