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

Function typecvt

imperative/python/megengine/xla/rules/elemwise.py:122–128  ·  view source on GitHub ↗
(inp, odtype)

Source from the content-addressed store, hash-verified

120
121
122def typecvt(inp, odtype):
123 odtype = np.dtype(odtype) if isinstance(odtype, str) else odtype
124 return HLOTensor(
125 hlo.ConvertOp(
126 ir_utils.make_ir_type_according_meta(inp.shape, odtype), inp.tensor
127 ).result
128 )
129
130
131def _compare(lhs, rhs, mode, comparison_type=None):

Callers 2

astypeMethod · 0.70
TEST_PASSFunction · 0.50

Calls 2

HLOTensorClass · 0.85
dtypeMethod · 0.45

Tested by 1

TEST_PASSFunction · 0.40