MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / is_fp_tensor

Function is_fp_tensor

PATH/core/fp16/utils.py:59–66  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

57 yield p
58
59def is_fp_tensor(x):
60 if is_nested(x):
61 # Fast-fail version of all(is_fp_tensor)
62 for y in x:
63 if not is_fp_tensor(y):
64 return False
65 return True
66 return is_tensor_like(x) and is_floating_point(x)
67
68def is_nested(x):
69 return isinstance(x, tuple) or isinstance(x, list)

Callers 2

collect_fp_tensor_typesFunction · 0.85
casted_argsFunction · 0.85

Calls 3

is_nestedFunction · 0.85
is_tensor_likeFunction · 0.85
is_floating_pointFunction · 0.85

Tested by

no test coverage detected