util.batch_length

util.batch_length(batch)[source]

Determine the number of samples in a batch.

Parameters:

batch : dict

A batch dictionary. Each value must implement len. All values must have the same len.

Returns:

n : int >= 0 or None

The number of samples in this batch. If the batch has no fields, n is None.

Raises:

RuntimeError

If some two values have unequal length