def expected(): log = relay.log(x) _log_left = relay.device_copy(log, dev1, dev2) _log_right = relay.device_copy(log, dev1, dev2) log2 = relay.log2(_log_left) log10 = relay.log10(_log_right) add = relay.add(log2, log10) _add = relay.device_copy(add, dev2, dev1) tan = relay.tan(_add) func = run_opt_pass(tan, transform.InferType()) return func
def annotated(): log = relay.log(x) _log = relay.annotation.on_device(log, expected_dev_type["log"]) log2 = relay.log2(_log) _log2 = relay.annotation.on_device(log2, expected_dev_type["log2"]) log10 = relay.log10(_log) _log10 = relay.annotation.on_device(log10, expected_dev_type["log10"]) add = relay.add(_log2, _log10) _add = relay.annotation.on_device(add, expected_dev_type["add"]) tan = relay.tan(_add) _tan = relay.annotation.on_device(tan, expected_dev_type["tan"]) func = run_opt_pass(_tan, transform.RewriteAnnotatedOps(dev1.device_type)) return func
def annotated(): log = relay.log(x) _log = relay.annotation.on_device(log, expected_dev_type['log']) log2 = relay.log2(_log) _log2 = relay.annotation.on_device(log2, expected_dev_type['log2']) log10 = relay.log10(_log) _log10 = relay.annotation.on_device(log10, expected_dev_type['log10']) add = relay.add(_log2, _log10) _add = relay.annotation.on_device(add, expected_dev_type['add']) tan = relay.tan(_add) _tan = relay.annotation.on_device(tan, expected_dev_type['tan']) func = run_opt_pass(_tan, transform.RewriteAnnotatedOps(ctx1.device_type)) return func