Function to reshape the vector by the number of dimensions of x. E.g. x (bs, c, h, w), v (bs) -> v (bs, 1, 1, 1).
(v, x)
| 146 | |
| 147 | |
| 148 | def pad_vector_like_x(v, x): |
| 149 | """ |
| 150 | Function to reshape the vector by the number of dimensions |
| 151 | of x. E.g. x (bs, c, h, w), v (bs) -> v (bs, 1, 1, 1). |
| 152 | """ |
| 153 | if isinstance(v, float): |
| 154 | return v |
| 155 | return v.reshape(-1, *([1] * (x.dim() - 1))) |
| 156 | |
| 157 | |
| 158 | def resize_ims(x: Tensor, size: int, mode: str = "bilinear", **kwargs): |
nothing calls this directly
no outgoing calls
no test coverage detected