예제 #1
0
파일: to_relay.py 프로젝트: zheng-xq/tvm
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)
예제 #2
0
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]