MCPcopy Create free account
hub / github.com/NVIDIA/DALI / get_random_torch_batch

Function get_random_torch_batch

dali/test/python/test_dltensor_operator.py:300–309  ·  view source on GitHub ↗
(g, shapes, dtype)

Source from the content-addressed store, hash-verified

298
299
300def get_random_torch_batch(g, shapes, dtype):
301 is_fp = torch.is_floating_point(torch.tensor([], dtype=dtype))
302 if is_fp:
303 return [torch.rand((shape), generator=g, dtype=dtype) for shape in shapes]
304 else:
305 iinfo = torch.iinfo(dtype)
306 dtype_min, dtype_max = iinfo.min, iinfo.max
307 return [
308 torch.randint(dtype_min, dtype_max, shape, generator=g, dtype=dtype) for shape in shapes
309 ]
310
311
312def get_sliced_torch_case(case_name):

Callers 2

_gpu_sliced_torch_caseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected