Create a tensor from shared memory with the specific name Parameters ---------- name : str The unique name of the shared memory shape : tuple of int The shape of the returned tensor dtype : F.dtype The dtype of the returned tensor Returns -------
(name, shape, dtype)
| 168 | |
| 169 | |
| 170 | def create_shared_mem_array(name, shape, dtype): |
| 171 | """Create a tensor from shared memory with the specific name |
| 172 | |
| 173 | Parameters |
| 174 | ---------- |
| 175 | name : str |
| 176 | The unique name of the shared memory |
| 177 | shape : tuple of int |
| 178 | The shape of the returned tensor |
| 179 | dtype : F.dtype |
| 180 | The dtype of the returned tensor |
| 181 | |
| 182 | Returns |
| 183 | ------- |
| 184 | F.tensor |
| 185 | The created tensor. |
| 186 | """ |
| 187 | new_arr = empty_shared_mem( |
| 188 | name, True, shape, F.reverse_data_type_dict[dtype] |
| 189 | ) |
| 190 | dlpack = new_arr.to_dlpack() |
| 191 | return F.zerocopy_from_dlpack(dlpack) |
| 192 | |
| 193 | |
| 194 | def exist_shared_mem_array(name): |
no test coverage detected