(self, rng: jax.Array)
| 825 | ) |
| 826 | |
| 827 | def init_weights(self, rng: jax.Array) -> FrozenDict: |
| 828 | # init input tensors |
| 829 | sample_shape = (1, self.in_channels, self.sample_size, self.sample_size) |
| 830 | sample = jnp.zeros(sample_shape, dtype=jnp.float32) |
| 831 | |
| 832 | params_rng, dropout_rng, gaussian_rng = jax.random.split(rng, 3) |
| 833 | rngs = {"params": params_rng, "dropout": dropout_rng, "gaussian": gaussian_rng} |
| 834 | |
| 835 | return self.init(rngs, sample)["params"] |
| 836 | |
| 837 | def encode(self, sample, deterministic: bool = True, return_dict: bool = True): |
| 838 | sample = jnp.transpose(sample, (0, 2, 3, 1)) |
no outgoing calls
no test coverage detected