MCPcopy Index your code
hub / github.com/tinygrad/tinygrad / _enqueue_batch

Function _enqueue_batch

examples/mlperf/dataloader.py:383–396  ·  view source on GitHub ↗
(bc)

Source from the content-addressed store, hash-verified

381
382def batch_load_retinanet(dataset, val:bool, base_dir:Path, batch_size:int=32, shuffle:bool=True, seed:int|None=None):
383 def _enqueue_batch(bc):
384 from extra.datasets.openimages import prepare_target
385 for idx in range(bc * batch_size, (bc+1) * batch_size):
386 img = dataset.loadImgs(next(dataset_iter))[0]
387 ann = dataset.loadAnns(dataset.getAnnIds(img_id:=img["id"]))
388 tgt = prepare_target(ann, img_id, (img["height"], img["width"]))
389
390 if img_ids is not None:
391 img_ids[idx] = img_id
392
393 if img_sizes is not None:
394 img_sizes[idx] = tgt["image_size"]
395
396 queue_in.put((idx, img, tgt))
397
398 def _setup_shared_mem(shm_name:str, size:tuple[int, ...], dtype:dtypes) -> tuple[shared_memory.SharedMemory, Tensor]:
399 shm_name = f"{shm_name}_{os.getpid()}"

Callers 2

__del__Method · 0.85
batch_load_retinanetFunction · 0.85

Calls 2

prepare_targetFunction · 0.90
putMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…