:param node_names: a list of names for each tree node :type node_names: List[str] :param parent_indices: an int32-typed tensor that represents the edge to its parent.\ -1 represents the root node :type parent_indices: Tensor :param local_translation:
(self, node_names, parent_indices, local_translation)
| 210 | ) |
| 211 | |
| 212 | def __init__(self, node_names, parent_indices, local_translation): |
| 213 | """ |
| 214 | :param node_names: a list of names for each tree node |
| 215 | :type node_names: List[str] |
| 216 | :param parent_indices: an int32-typed tensor that represents the edge to its parent.\ |
| 217 | -1 represents the root node |
| 218 | :type parent_indices: Tensor |
| 219 | :param local_translation: a 3d vector that gives local translation information |
| 220 | :type local_translation: Tensor |
| 221 | """ |
| 222 | ln, lp, ll = len(node_names), len(parent_indices), len(local_translation) |
| 223 | assert len(set((ln, lp, ll))) == 1 |
| 224 | self._node_names = node_names |
| 225 | self._parent_indices = parent_indices.long() |
| 226 | self._local_translation = local_translation |
| 227 | self._node_indices = {self.node_names[i]: i for i in range(len(self))} |
| 228 | |
| 229 | def __len__(self): |
| 230 | """number of nodes in the skeleton tree""" |