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

Class MockTensor

dali/test/python/experimental_mode/test_invocation.py:20–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18
19
20class MockTensor:
21 def __init__(self, data, layout=None):
22 self.shape = data.shape
23 self.dtype = ndd.dtype(data.dtype)
24 self.layout = layout
25 self.device = ndd.Device("cpu")
26 self.data = data
27
28 @property
29 def ndim(self):
30 return len(self._shape)
31
32 def __repr__(self):
33 return f"MockTensor(data={self.data}, layout={self.layout})"
34
35 def __eq__(self, other):
36 return np.array_equal(self.data, other.data) and self.layout == other.layout
37
38
39class MockBatch:

Callers 6

_runMethod · 0.85
test_mock_operator_batchFunction · 0.85
test_invocation_tensorFunction · 0.85
test_invocation_batchFunction · 0.85

Calls

no outgoing calls

Tested by 6

_runMethod · 0.68
test_mock_operator_batchFunction · 0.68
test_invocation_tensorFunction · 0.68
test_invocation_batchFunction · 0.68