Get a tensor from shared memory with 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 ------- F.
(name, shape, dtype)
| 144 | |
| 145 | |
| 146 | def get_shared_mem_array(name, shape, dtype): |
| 147 | """Get a tensor from shared memory with specific name |
| 148 | |
| 149 | Parameters |
| 150 | ---------- |
| 151 | name : str |
| 152 | The unique name of the shared memory |
| 153 | shape : tuple of int |
| 154 | The shape of the returned tensor |
| 155 | dtype : F.dtype |
| 156 | The dtype of the returned tensor |
| 157 | |
| 158 | Returns |
| 159 | ------- |
| 160 | F.tensor |
| 161 | The tensor got from shared memory. |
| 162 | """ |
| 163 | new_arr = empty_shared_mem( |
| 164 | name, False, shape, F.reverse_data_type_dict[dtype] |
| 165 | ) |
| 166 | dlpack = new_arr.to_dlpack() |
| 167 | return F.zerocopy_from_dlpack(dlpack) |
| 168 | |
| 169 | |
| 170 | def create_shared_mem_array(name, shape, dtype): |
no test coverage detected