multi_apply(lambda a, b: (a*2, b/2), [1, 2, 3, 4], [5, 6, 7, 8])([2, 4, 6, 8], [2.5, 3.0, 3.5, 4.0])
multi_apply (func:Callable[...,Any], *args:Any, **kwargs:Any)
*Applies the function func to each set of arguments in *args, possibly using keyword arguments **kwargs.
Based on OpenMMLab’s implementation in the mmdetection library:
| Type | Details | |
|---|---|---|
| func | Callable | Function to apply. |
| args | Any | |
| kwargs | Any | |
| Returns | Tuple |
([2, 4, 6, 8], [2.5, 3.0, 3.5, 4.0])
generate_output_grids (height, width, strides=[8, 16, 32])
*Generate a tensor containing grid coordinates and strides for a given height and width.
Args: height (int): The height of the image. width (int): The width of the image.
Returns: torch.Tensor: A tensor containing grid coordinates and strides.*