MCPcopy Create free account
hub / github.com/thygate/stable-diffusion-webui-depthmap-script / _make_scratch

Function _make_scratch

dmidas/blocks.py:136–166  ·  view source on GitHub ↗
(in_shape, out_shape, groups=1, expand=False)

Source from the content-addressed store, hash-verified

134
135
136def _make_scratch(in_shape, out_shape, groups=1, expand=False):
137 scratch = nn.Module()
138
139 out_shape1 = out_shape
140 out_shape2 = out_shape
141 out_shape3 = out_shape
142 if len(in_shape) >= 4:
143 out_shape4 = out_shape
144
145 if expand:
146 out_shape1 = out_shape
147 out_shape2 = out_shape*2
148 out_shape3 = out_shape*4
149 if len(in_shape) >= 4:
150 out_shape4 = out_shape*8
151
152 scratch.layer1_rn = nn.Conv2d(
153 in_shape[0], out_shape1, kernel_size=3, stride=1, padding=1, bias=False, groups=groups
154 )
155 scratch.layer2_rn = nn.Conv2d(
156 in_shape[1], out_shape2, kernel_size=3, stride=1, padding=1, bias=False, groups=groups
157 )
158 scratch.layer3_rn = nn.Conv2d(
159 in_shape[2], out_shape3, kernel_size=3, stride=1, padding=1, bias=False, groups=groups
160 )
161 if len(in_shape) >= 4:
162 scratch.layer4_rn = nn.Conv2d(
163 in_shape[3], out_shape4, kernel_size=3, stride=1, padding=1, bias=False, groups=groups
164 )
165
166 return scratch
167
168
169def _make_pretrained_efficientnet_lite3(use_pretrained, exportable=False):

Callers 1

_make_encoderFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected