MCPcopy Create free account
hub / github.com/apple/axlearn / predict

Method predict

axlearn/common/trainer_test.py:254–258  ·  view source on GitHub ↗
(self, input_batch: NestedTensor)

Source from the content-addressed store, hash-verified

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"]

Callers 1

forwardMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected