MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / base_conv2d

Function base_conv2d

diffsynth/models/stepvideo_vae.py:62–72  ·  view source on GitHub ↗
(x, conv_layer, channel_last=False, residual=None)

Source from the content-addressed store, hash-verified

60 return out
61
62def base_conv2d(x, conv_layer, channel_last=False, residual=None):
63 if channel_last:
64 x = x.permute(0, 3, 1, 2) # NHWC to NCHW
65 out = F.conv2d(x, conv_layer.weight, conv_layer.bias, stride=conv_layer.stride, padding=conv_layer.padding)
66 if residual is not None:
67 if channel_last:
68 residual = residual.permute(0, 3, 1, 2) # NHWC to NCHW
69 out += residual
70 if channel_last:
71 out = out.permute(0, 2, 3, 1) # NCHW to NHWC
72 return out
73
74def base_conv3d(x, conv_layer, channel_last=False, residual=None, only_return_output=False):
75 if only_return_output:

Callers 2

forwardMethod · 0.85
forwardMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected