MCPcopy Create free account
hub / github.com/Gabesarch/ICAL / normalize_grid3d

Function normalize_grid3d

TEACh/utils/basic.py:183–194  ·  view source on GitHub ↗
(grid_z, grid_y, grid_x, Z, Y, X, clamp_extreme=True)

Source from the content-addressed store, hash-verified

181 return xy
182
183def normalize_grid3d(grid_z, grid_y, grid_x, Z, Y, X, clamp_extreme=True):
184 # make things in [-1,1]
185 grid_z = 2.0*(grid_z / float(Z-1)) - 1.0
186 grid_y = 2.0*(grid_y / float(Y-1)) - 1.0
187 grid_x = 2.0*(grid_x / float(X-1)) - 1.0
188
189 if clamp_extreme:
190 grid_z = torch.clamp(grid_z, min=-2.0, max=2.0)
191 grid_y = torch.clamp(grid_y, min=-2.0, max=2.0)
192 grid_x = torch.clamp(grid_x, min=-2.0, max=2.0)
193
194 return grid_z, grid_y, grid_x
195
196def normalize_grid2d(grid_y, grid_x, Y, X, clamp_extreme=True):
197 # make things in [-1,1]

Callers 3

meshgrid3dFunction · 0.85
meshgrid3drFunction · 0.85
meshgrid3d_pyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected