MCPcopy Create free account
hub / github.com/allenai/molmo2 / max

Method max

olmo/preprocessing/preprocessor_utils.py:83–94  ·  view source on GitHub ↗
(*other: 'TensorSpec')

Source from the content-addressed store, hash-verified

81
82 @staticmethod
83 def max(*other: 'TensorSpec'):
84 other = [o for o in other if o is not None]
85 if not other:
86 return None
87 rank = len(other[0].shape)
88 dtype = other[0].dtype
89 assert all(rank == len(o.shape) for o in other)
90 assert all(dtype == o.dtype for o in other)
91 return TensorSpec(
92 [max([o.shape[i] for o in other]) for i in range(rank)],
93 dtype
94 )
95
96 def max_dictionaries(*other: Dict[str, 'TensorSpec']):
97 return {k: TensorSpec.max(*(o[k] for o in other if k in o)) for k in get_all_keys(other)}

Callers 15

collect_validFunction · 0.80
get_absolute_coordinatesFunction · 0.80
example_to_html_dictFunction · 0.80
extract_pointsMethod · 0.80
_collateFunction · 0.80
max_dictionariesMethod · 0.80
build_batched_imagesMethod · 0.80
build_batched_videosMethod · 0.80
build_batched_imagesMethod · 0.80
build_batched_videosMethod · 0.80

Calls 1

TensorSpecClass · 0.85

Tested by

no test coverage detected