(self)
| 151 | dtype: jnp.dtype = jnp.float32 |
| 152 | |
| 153 | def setup(self): |
| 154 | inner_dim = self.dim_head * self.heads |
| 155 | self.scale = self.dim_head**-0.5 |
| 156 | |
| 157 | # Weights were exported with old names {to_q, to_k, to_v, to_out} |
| 158 | self.query = nn.Dense(inner_dim, use_bias=False, dtype=self.dtype, name="to_q") |
| 159 | self.key = nn.Dense(inner_dim, use_bias=False, dtype=self.dtype, name="to_k") |
| 160 | self.value = nn.Dense(inner_dim, use_bias=False, dtype=self.dtype, name="to_v") |
| 161 | |
| 162 | self.proj_attn = nn.Dense(self.query_dim, dtype=self.dtype, name="to_out_0") |
| 163 | self.dropout_layer = nn.Dropout(rate=self.dropout) |
| 164 | |
| 165 | def reshape_heads_to_batch_dim(self, tensor): |
| 166 | batch_size, seq_len, dim = tensor.shape |
nothing calls this directly
no outgoing calls
no test coverage detected