MCPcopy Create free account
hub / github.com/cvg/megaflow / gridcloud2d

Function gridcloud2d

megaflow/utils/basic.py:130–138  ·  view source on GitHub ↗
(B, Y, X, norm=False, device='cuda')

Source from the content-addressed store, hash-verified

128 return grid_y, grid_x
129
130def gridcloud2d(B, Y, X, norm=False, device='cuda'):
131 # we want to sample for each location in the grid
132 grid_y, grid_x = meshgrid2d(B, Y, X, device=device)
133 x = torch.reshape(grid_x, [B, -1])
134 y = torch.reshape(grid_y, [B, -1])
135 # these are B x N
136 xy = torch.stack([x, y], dim=2)
137 # this is B x N x 2
138 return xy
139
140def reduce_masked_mean(x, mask, dim=None, keepdim=False, broadcast=False):
141 # x and mask are the same shape, or at least broadcastably so < actually it's safer if you disallow broadcasting

Callers 4

process_sequenceFunction · 0.90
run_trackingFunction · 0.90
pointflow_loss_funcFunction · 0.90
validation_stepMethod · 0.90

Calls 1

meshgrid2dFunction · 0.85

Tested by

no test coverage detected