Seeded Batch Order for an Epoch

~10 mincode completion

Implement epoch_batches(n, batch_size, seed, epoch) returning an integer array of shape (n // batch_size, batch_size) with the batches of the requested epoch.

Where this shows up

~10 min

8 employers weight this skill

3 quant funds, 2 big tech firms, 1 health and bio company, 1 AI product company, 1 defense company. Top match scores 75.

Python
import numpy as np


def epoch_batches(n, batch_size, seed, epoch):
    """
    The batches a seeded training run sees in a given epoch.

    Args:
        n:          number of training examples
        batch_size: examples per batch (the incomplete last batch is dropped)
        seed:       the run's seed for np.random.default_rng
        epoch:      which epoch, starting at 0

    Returns:
        integer array of shape (n // batch_size, batch_size)
    """
    # YOUR CODE HERE
    pass

Run your code to see results

⌘↵ runs against the visible tests

Loading docs…

The AI Mentor needs an account

It reads your code and the failing tests and nudges you toward the fix without handing you the answer. Free accounts get it on every problem you're working on today.