Exemplo n.º 1
0
width = 224
height = 224
image_data = load_test_image(dtype, width, height)

input_tensor = "input"
input_shape = (1, 224, 224, 3)
input_dtype = dtype

# Parse TFLite model and convert it to a Relay module
mod, params = relay.frontend.from_tflite(
    tflite_model,
    shape_dict={input_tensor: input_shape},
    dtype_dict={input_tensor: input_dtype})

tvm_target = get_tvm_target(device, get_device_type(), get_device_arch(),
                            get_device_attributes())

tvm_targets = tvm.target.Target(tvm_target)
cpu_target = "llvm"
target_host = cpu_target

cpudevice = tvm.runtime.cpu()
ctx = tvm.runtime.context("cpu")

enable_acl = True
tvm_ops = 80
acl_partitions = 38
atol = 0.002
rtol = 0.01

try:
Exemplo n.º 2
0
image_data = load_test_image(dtype, width, height)

input_tensor = "Placeholder"
input_shape = (1, 224, 224, 3)
input_dtype = dtype

# Parse TFLite model and convert it to a Relay module
mod, params = relay.frontend.from_tflite(tflite_model,
                                         shape_dict={input_tensor: input_shape},
                                         dtype_dict={input_tensor: input_dtype})
desired_layouts = {'nn.conv2d': ['NCHW', 'default']}
seq = tvm.transform.Sequential([relay.transform.RemoveUnusedFunctions(),relay.transform.ConvertLayout(desired_layouts)])
with tvm.transform.PassContext(opt_level=3):
    mod = seq(mod)

tvm_target = get_tvm_target(device, get_device_type(), get_device_arch(), get_device_attributes())
tvm_targets = tvm.target.Target(tvm_target)
cpu_target = "llvm"
target_host=cpu_target

cpudevice = tvm.runtime.cpu()
ctx = tvm.runtime.context("cpu")

enable_acl=True
tvm_ops=171
acl_partitions=1
atol=0.002
rtol=0.01

try:
    lib = build_module(mod, tvm_target, params, enable_acl, tvm_ops, acl_partitions)