MCPcopy Create free account
hub / github.com/dcharatan/flowmap / rescale_flow

Method rescale_flow

flowmap/flow/flow_predictor.py:40–47  ·  view source on GitHub ↗
(
        flow: Float[Tensor, "batch frame height width 2"],
        shape: tuple[int, int],
    )

Source from the content-addressed store, hash-verified

38
39 @staticmethod
40 def rescale_flow(
41 flow: Float[Tensor, "batch frame height width 2"],
42 shape: tuple[int, int],
43 ) -> Float[Tensor, "batch frame height_scaled width_scaled 2"]:
44 b, f, _, _, _ = flow.shape
45 flow = rearrange(flow, "b f h w xy -> (b f) xy h w")
46 flow = F.interpolate(flow, shape, mode="bilinear", align_corners=False)
47 return rearrange(flow, "(b f) xy h w -> b f h w xy", b=b, f=f)
48
49 @staticmethod
50 def rescale_mask(

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected