def _divide(children, attrs, odtype='float32'): if len(children) == 1: left = children[0] scalar = attrs.get_float('scalar') right = relay.const(scalar, dtype=odtype) else: assert len(children) == 2 left = children[0] right = children[1] return op.divide(left, right)
def aten_div(inputs, attributes, scope): # print_inputs(inputs) lfs, rfs = inputs ctx = current_context() net = ctx.network if ctx.is_tensorrt and has_trt_tensor(inputs): output = _scale_or_elementwise(net, lfs, rfs, "div", scope) output.name = scope return [output] elif ctx.is_tvm and has_tvm_tensor(inputs): lfs, rfs = _tvm_to_const([lfs, rfs]) return [_op.divide(lfs, rfs)] return [lfs / rfs]