(self, batch: AttrDict, options: Optional[AttrDict] = None)
| 170 | """ |
| 171 | |
| 172 | def encode_to_vector(self, batch: AttrDict, options: Optional[AttrDict] = None) -> torch.Tensor: |
| 173 | h, it = self.get_h_and_iterator(batch, options=options) |
| 174 | n_unrolls = self.get_n_unrolls() |
| 175 | |
| 176 | for _ in range(n_unrolls): |
| 177 | data = next(it) |
| 178 | h = self.encoder(h, data) |
| 179 | h = self.processor(h) |
| 180 | |
| 181 | h = self.output_proj(self.ln_post(h[:, -self.latent_ctx :])) |
| 182 | return h.flatten(1) |
| 183 | |
| 184 | def get_n_unrolls(self): |
| 185 | if self.training: |
nothing calls this directly
no test coverage detected