(self)
| 221 | dtype: jnp.dtype = jnp.float32 |
| 222 | |
| 223 | def setup(self): |
| 224 | self.num_heads = self.channels // self.num_head_channels if self.num_head_channels is not None else 1 |
| 225 | |
| 226 | dense = partial(nn.Dense, self.channels, dtype=self.dtype) |
| 227 | |
| 228 | self.group_norm = nn.GroupNorm(num_groups=self.num_groups, epsilon=1e-6) |
| 229 | self.query, self.key, self.value = dense(), dense(), dense() |
| 230 | self.proj_attn = dense() |
| 231 | |
| 232 | def transpose_for_scores(self, projection): |
| 233 | new_projection_shape = projection.shape[:-1] + (self.num_heads, -1) |
nothing calls this directly
no outgoing calls
no test coverage detected