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

Function fill_like_lower

imperative/python/megengine/xla/rules/tensor.py:727–738  ·  view source on GitHub ↗
(ctx, *args: Union[HLOTensor, Sequence[HLOTensor]])

Source from the content-addressed store, hash-verified

725
726@register_lower_rule(mops.FillLike)
727def fill_like_lower(ctx, *args: Union[HLOTensor, Sequence[HLOTensor]]):
728 assert len(args) == 1 and len(ctx.vars_in) == 1 and len(ctx.vars_out) == 1
729 var_in, var_out, opr = ctx.vars_in[0], ctx.vars_out[0], ctx.op
730 value = opr.value
731
732 assert _shape_equal(var_in.shape, var_out.shape) and _shape_equal(
733 var_out.shape, args[0].shape
734 )
735 assert var_in.dtype == var_out.dtype and args[0].dtype == var_out.dtype
736 shape, dtype = var_out.shape, var_out.dtype
737
738 return fill(value, shape, dtype)
739
740
741@register_lower_rule(mops.Reshape)

Callers

nothing calls this directly

Calls 2

_shape_equalFunction · 0.85
fillFunction · 0.85

Tested by

no test coverage detected