MCPcopy Index your code
hub / github.com/apache/tvm / empty

Method empty

python/tvm/runtime/disco/session.py:130–167  ·  view source on GitHub ↗

Create an empty Tensor on all workers and attach them to a DRef. Parameters ---------- shape : tuple of int The shape of the Tensor. dtype : str The data type of the Tensor. device : Optional[Device] = None The device of

(
        self,
        shape: Sequence[int],
        dtype: str,
        device: Device | None = None,
        worker0_only: bool = False,
        in_group: bool = True,
    )

Source from the content-addressed store, hash-verified

128 return func
129
130 def empty(
131 self,
132 shape: Sequence[int],
133 dtype: str,
134 device: Device | None = None,
135 worker0_only: bool = False,
136 in_group: bool = True,
137 ) -> DRef:
138 """Create an empty Tensor on all workers and attach them to a DRef.
139
140 Parameters
141 ----------
142 shape : tuple of int
143 The shape of the Tensor.
144
145 dtype : str
146 The data type of the Tensor.
147
148 device : Optional[Device] = None
149 The device of the Tensor.
150
151 worker0_only: bool
152 If False (default), allocate an array on each worker. If
153 True, only allocate an array on worker0.
154
155 in_group: bool
156 Take effective when `worker0_only` is True. If True (default),
157 allocate an array on each first worker in each group. If
158 False, only allocate an array on worker0 globally.
159
160 Returns
161 -------
162 array : DRef
163 The created Tensor.
164
165 """
166 func = self._get_cached_method("runtime.disco.empty")
167 return func(Shape(shape), dtype, device, worker0_only, in_group)
168
169 def shutdown(self):
170 """Shut down the Disco session"""

Callers 15

copy_to_worker_0Method · 0.95
broadcastMethod · 0.95
scatterMethod · 0.95
load_tensor_cacheFunction · 0.45
allocate_hexagon_arrayFunction · 0.45
_convert_call_tirMethod · 0.45
__call__Method · 0.45
alloc_tensorFunction · 0.45
max_curveFunction · 0.45
_fetch_indicesMethod · 0.45
_flush_l2_legacyFunction · 0.45
numpyMethod · 0.45

Calls 3

_get_cached_methodMethod · 0.95
funcFunction · 0.50
ShapeFunction · 0.50

Tested by

no test coverage detected