MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / __concat_value__

Method __concat_value__

detrsmpl/data/data_structures/human_data.py:1268–1298  ·  view source on GitHub ↗

Concat two values from two different HumanData. Args: key (Any): The common key of the two values. value_0 (Any): Value from 0. value_1 (Any): Value from 1. dim_0 (Union[None, int]):

(cls, key: Any, value_0: Any, value_1: Any,
                         dim_0: Union[None, int], dim_1: Union[None,
                                                               int])

Source from the content-addressed store, hash-verified

1266
1267 @classmethod
1268 def __concat_value__(cls, key: Any, value_0: Any, value_1: Any,
1269 dim_0: Union[None, int], dim_1: Union[None,
1270 int]) -> dict:
1271 """Concat two values from two different HumanData.
1272
1273 Args:
1274 key (Any):
1275 The common key of the two values.
1276 value_0 (Any):
1277 Value from 0.
1278 value_1 (Any):
1279 Value from 1.
1280 dim_0 (Union[None, int]):
1281 The dim for concat and slice. None for N/A.
1282 dim_1 (Union[None, int]):
1283 The dim for concat and slice. None for N/A.
1284
1285 Returns:
1286 dict:
1287 Dict for concatenated result.
1288 """
1289 ret_dict = {}
1290 if dim_0 is None or dim_1 is None:
1291 ret_dict[f'{key}_0'] = value_0
1292 ret_dict[f'{key}_1'] = value_1
1293 elif isinstance(value_0, list):
1294 ret_dict[key] = value_0 + value_1
1295 # elif isinstance(value_0, np.ndarray):
1296 else:
1297 ret_dict[key] = np.concatenate((value_0, value_1), axis=dim_0)
1298 return ret_dict
1299
1300 @classmethod
1301 def __add_zero_pad__(cls, compressed_array: np.ndarray,

Callers 1

concatenateMethod · 0.80

Calls 1

concatenateMethod · 0.80

Tested by

no test coverage detected