Adds a layer that performs a gather with some element-wise dimensions. See: https://onnx.ai/onnx/operators/onnx__GatherND.html The gather is performed on dim=batch_dims. Parameters: input: Tensor The tensor on which the gather operation is performed. ind
(input: Tensor, indices: Tensor, batch_dims: int = 1)
| 2311 | |
| 2312 | |
| 2313 | def gather_nd(input: Tensor, indices: Tensor, batch_dims: int = 1) -> Tensor: |
| 2314 | ''' |
| 2315 | Adds a layer that performs a gather with some element-wise dimensions. |
| 2316 | See: https://onnx.ai/onnx/operators/onnx__GatherND.html |
| 2317 | The gather is performed on dim=batch_dims. |
| 2318 | |
| 2319 | Parameters: |
| 2320 | input: Tensor |
| 2321 | The tensor on which the gather operation is performed. |
| 2322 | indices: Tensor |
| 2323 | The tensor that indicates which entries to be gathered. |
| 2324 | batch_dims: int |
| 2325 | The number of first dimensions that should be skipped before gather starts. |
| 2326 | Returns: |
| 2327 | A tensor created by the gather layer with GatherMode.ND. |
| 2328 | ''' |
| 2329 | gather_layer = default_trtnet().add_gather_v2(input.trt_tensor, |
| 2330 | indices.trt_tensor, |
| 2331 | mode=trt.GatherMode.ND) |
| 2332 | gather_layer.num_elementwise_dims = batch_dims |
| 2333 | return _create_tensor(gather_layer.get_output(0), gather_layer) |
| 2334 | |
| 2335 | |
| 2336 | def nonzero(input: Tensor) -> Tensor: |
no test coverage detected