MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / cast_tensors

Function cast_tensors

imperative/python/megengine/core/tensor/utils.py:60–65  ·  view source on GitHub ↗
(*args, promote=False)

Source from the content-addressed store, hash-verified

58
59
60def cast_tensors(*args, promote=False):
61 if promote:
62 dtype = _get_amp_high_prec_dtype()
63 else:
64 dtype = _get_amp_low_prec_dtype()
65 return tuple(arg.astype(dtype) if arg is not None else None for arg in args)
66
67
68def result_type(*args):

Callers 5

conv1dFunction · 0.85
conv2dFunction · 0.85
conv_transpose2dFunction · 0.85
deformable_conv2dFunction · 0.85
sync_batch_normFunction · 0.85

Calls 1

astypeMethod · 0.45

Tested by

no test coverage detected