Inference & Serving · Problem 1 of 5
Implement temperature + top- + top- sampling from a logits vector in numpy.
Implement the function/class skeleton in the editor. Any correct approach is accepted.
import numpy as np
def sample(logits, temperature=1.0, top_k=0, top_p=1.0, rng=None):
raise NotImplementedError
def _softmax(x):
raise NotImplementedErrorReady when you are
Submit your solution and a structured review appears here — verdict, score, and concrete feedback. Any correct approach passes.
Implement temperature + top- + top- sampling from a logits vector in numpy.
Implement the function/class skeleton in the editor. Any correct approach is accepted.