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,
)
| 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""" |
no test coverage detected