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

Function where_lower

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

Source from the content-addressed store, hash-verified

784
785@register_lower_rule(mops.Where)
786def where_lower(ctx, *args: Union[HLOTensor, Sequence[HLOTensor]]):
787 assert len(args) == 3 and len(ctx.vars_in) == 3 and len(ctx.vars_out) == 1
788 assert _shape_equal(ctx.vars_in[0].shape, ctx.vars_in[1].shape) and _shape_equal(
789 ctx.vars_in[0].shape, ctx.vars_in[2].shape
790 )
791 return where(args[0], args[1], args[2])
792
793
794@register_lower_rule("WhereBackward", mops.WhereBackward)

Callers

nothing calls this directly

Calls 2

_shape_equalFunction · 0.85
whereFunction · 0.70

Tested by

no test coverage detected