(self, input_batch: NestedTensor)
| 252 | label: Tensor = input_batch["label"] |
| 253 | loss = ( |
| 254 | -(jax.nn.log_softmax(logits) * jax.nn.one_hot(label, NUM_CLASSES, dtype=logits.dtype)) |
| 255 | .sum(axis=-1) |
| 256 | .mean() |
| 257 | ) |
| 258 | return loss, {"prng_key": self.prng_key} |
| 259 | |
| 260 | def predict(self, input_batch: NestedTensor) -> Tensor: |
| 261 | image = input_batch["image"] |