MCPcopy Create free account
hub / github.com/SpatialVLA/SpatialVLA / __call__

Method __call__

model/action_tokenizer.py:37–44  ·  view source on GitHub ↗

Discretize continuous actions to tokens. action: np.ndarray, (n, 7), continuous actions in Cartesian or Spherical coordinates. return: np.ndarray, (n, 7), tokens.

(self, action: np.ndarray)

Source from the content-addressed store, hash-verified

35 self.token_end_idx = self.tokenizer.convert_tokens_to_ids(self.token_array[-1])
36
37 def __call__(self, action: np.ndarray) -> List[str]:
38 """Discretize continuous actions to tokens.
39 action: np.ndarray, (n, 7), continuous actions in Cartesian or Spherical coordinates.
40 return: np.ndarray, (n, 7), tokens.
41 """
42 action = np.clip(action, a_min=float(self.min_action), a_max=float(self.max_action))
43 ids = np.digitize(action, self.bin_centers, right=True) # [0, 255]
44 return self.token_array[ids]
45
46 def decode_token_ids_to_actions(self, action_token_id: np.ndarray) -> np.ndarray:
47 """decode token ids to continuous actions.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected