MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / setup

Method setup

diffusers/src/diffusers/models/resnet_flax.py:70–104  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

68 dtype: jnp.dtype = jnp.float32
69
70 def setup(self):
71 out_channels = self.in_channels if self.out_channels is None else self.out_channels
72
73 self.norm1 = nn.GroupNorm(num_groups=32, epsilon=1e-5)
74 self.conv1 = nn.Conv(
75 out_channels,
76 kernel_size=(3, 3),
77 strides=(1, 1),
78 padding=((1, 1), (1, 1)),
79 dtype=self.dtype,
80 )
81
82 self.time_emb_proj = nn.Dense(out_channels, dtype=self.dtype)
83
84 self.norm2 = nn.GroupNorm(num_groups=32, epsilon=1e-5)
85 self.dropout = nn.Dropout(self.dropout_prob)
86 self.conv2 = nn.Conv(
87 out_channels,
88 kernel_size=(3, 3),
89 strides=(1, 1),
90 padding=((1, 1), (1, 1)),
91 dtype=self.dtype,
92 )
93
94 use_nin_shortcut = self.in_channels != out_channels if self.use_nin_shortcut is None else self.use_nin_shortcut
95
96 self.conv_shortcut = None
97 if use_nin_shortcut:
98 self.conv_shortcut = nn.Conv(
99 out_channels,
100 kernel_size=(1, 1),
101 strides=(1, 1),
102 padding="VALID",
103 dtype=self.dtype,
104 )
105
106 def __call__(self, hidden_states, temb, deterministic=True):
107 residual = hidden_states

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected