MCPcopy Create free account
hub / github.com/allenai/molmoact2 / normalize

Method normalize

experiments/olmo/data/robot_processing.py:252–274  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

250 return None
251
252 def normalize(self, x):
253 arr = _to_array(x)
254 if arr is None:
255 return None
256 normed = _normalize_array(
257 arr,
258 mean=self.mean,
259 std=self.std,
260 min_val=self.min_val,
261 max_val=self.max_val,
262 q_low=self.q_low,
263 q_high=self.q_high,
264 mode=self.mode,
265 )
266 if _uses_bounded_normalized_range(self.mode):
267 normed = np.clip(normed, -1.0, 1.0)
268 if self.mask is not None:
269 normed = np.where(self.mask, normed, arr)
270 if self.zero_mask is not None:
271 normed = np.where(self.zero_mask, 0.0, normed)
272 if torch.is_tensor(x):
273 return torch.as_tensor(normed, device=x.device, dtype=x.dtype)
274 return normed
275
276 def unnormalize(self, x):
277 arr = _to_array(x)

Callers 8

normalize_actionMethod · 0.45
normalize_stateMethod · 0.45
normalize_labelMethod · 0.45
normalize_labelMethod · 0.45
normalize_labelMethod · 0.45
compute_cosine_simsFunction · 0.45
orthogonal_loss_fnFunction · 0.45

Calls 3

_normalize_arrayFunction · 0.85
_to_arrayFunction · 0.70

Tested by

no test coverage detected