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

Function import_numpy

dali/python/nvidia/dali/_utils/external_source_impl.py:25–35  ·  view source on GitHub ↗

Import numpy lazily, need to define global `np = None` variable

()

Source from the content-addressed store, hash-verified

23
24
25def import_numpy():
26 """Import numpy lazily, need to define global `np = None` variable"""
27 global np
28 if np is None:
29 try:
30 import numpy as np
31 except ImportError:
32 raise RuntimeError(
33 "Could not import numpy. Please make sure you have numpy "
34 "installed before you use parallel mode."
35 )
36
37
38class SourceKind(Enum):

Callers 4

sample_to_numpyFunction · 0.70
batch_to_numpyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected