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

Class ArgCb

dali/test/python/sequences_test_utils.py:60–91  ·  view source on GitHub ↗

Describes a callback to be used as a per-sample/per-frame argument to the operator. ---------- name : Union[str, int] String with the name of a named argument of the operator or an int if the data should be passed as a positional input. cb : Callable[[SampleDesc

Source from the content-addressed store, hash-verified

58
59
60class ArgCb:
61 """
62 Describes a callback to be used as a per-sample/per-frame argument to the operator.
63 ----------
64 name : Union[str, int]
65 String with the name of a named argument of the operator or an int if the data
66 should be passed as a positional input.
67 cb : Callable[[SampleDesc], np.ndarray]
68 Callback that based on the SampleDesc instance produces a single parameter for
69 specific sample/frame.
70 is_per_frame : bool
71 Flag if the cb should be run for every sample (sequence) or for every frame.
72 In the latter case, the argument is passed wrapped
73 in per-frame call to the operator.
74 dest_device : str
75 Controls whether the produced data should be passed to the operator in cpu or gpu memory.
76 If set to "gpu", the copy to gpu is added in the pipeline.
77 Applicable only to positional inputs.
78 """
79
80 def __init__(
81 self,
82 name: Union[str, int],
83 cb: Callable[[SampleDesc], np.ndarray],
84 is_per_frame: bool,
85 dest_device: str = "cpu",
86 ):
87 self.desc = ArgDesc(name, "F" if is_per_frame else "", dest_device)
88 self.cb = cb
89
90 def __repr__(self):
91 return "ArgCb{}".format((self.cb, self.desc))
92
93
94@dataclass

Callers 9

test_sequencesFunction · 0.90
test_videoFunction · 0.90
test_per_frameFunction · 0.90
test_videoFunction · 0.90
test_per_frameFunction · 0.90
test_sequencesFunction · 0.90
test_videoFunction · 0.90
test_videoFunction · 0.90
test_3d_sequenceFunction · 0.90

Calls

no outgoing calls

Tested by 9

test_sequencesFunction · 0.72
test_videoFunction · 0.72
test_per_frameFunction · 0.72
test_videoFunction · 0.72
test_per_frameFunction · 0.72
test_sequencesFunction · 0.72
test_videoFunction · 0.72
test_videoFunction · 0.72
test_3d_sequenceFunction · 0.72