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

Function casted_args

PATH/core/fp16/utils.py:122–133  ·  view source on GitHub ↗
(cast_fn, args, kwargs)

Source from the content-addressed store, hash-verified

120
121# NB: returneds casted `args`, mutates `kwargs` in-place
122def casted_args(cast_fn, args, kwargs):
123 new_args = []
124 for x in args:
125 if is_fp_tensor(x):
126 new_args.append(cast_fn(x))
127 else:
128 new_args.append(x)
129 for k in kwargs:
130 val = kwargs[k]
131 if is_fp_tensor(val):
132 kwargs[k] = cast_fn(val)
133 return new_args
134
135def cached_cast(cast_fn, x, cache):
136 if is_nested(x):

Callers

nothing calls this directly

Calls 1

is_fp_tensorFunction · 0.85

Tested by

no test coverage detected