示例#1
0
 def main(buffer2: T.Buffer[(160,), "uint8"], buffer4: T.Buffer[(144,), "uint8"], buffer6: T.Buffer[(144,), "uint8"], buffer8: T.Buffer[(144,), "uint8"]) -> None:
     # function attr dict
     T.func_attr({"from_legacy_te_schedule": True, "global_symbol": "main", "tir.noalias": True})
     v1a = T.var("int32")
     v1c = T.var("int32")
     v2a = T.var("int32")
     v2c = T.var("int32")
     v3a = T.var("int32")
     v3c = T.var("int32")
     v4a = T.var("int32")
     v4c = T.var("int32")
     buffer1 = T.buffer_decl([8192], "int8")
     buffer10 = T.buffer_decl([2048], "int8")
     # body
     p4 = T.allocate([160], "uint8", "global")
     p7 = T.allocate([144], "uint8", "global")
     p10 = T.allocate([144], "uint8", "global")
     p11 = T.allocate([144], "uint8", "global")
     with T.attr(T.iter_var(v1a, None, "DataPar", ""), "pragma_compute_cycles_hint", 201):
         T.evaluate(T.call_extern("ethosu_copy", buffer2[0], 160, p4[0], dtype="handle"))
     with T.attr(T.iter_var(v2a, None, "DataPar", ""), "pragma_compute_cycles_hint", 205):
         T.evaluate(T.call_extern("ethosu_copy", buffer4[0], 144, p7[0], dtype="handle"))
     with T.attr(T.iter_var(v1c, None, "DataPar", ""), "pragma_compute_cycles_hint", 300):
         T.evaluate(T.call_extern("ethosu_conv2d", "int8", 16, 16, 32, 16, 0, 16, buffer1[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 512, 32, 1, "int8", 16, 16, 2, 16, 0, 16, buffer10[0], 0, 0, 0, T.float32(0.25), 14, "NHWC", 128, 8, 1, 1, 1, 1, 1, 1, 1, p4[0], 128, 12, p4[128], 32, 0, 0, 0, 0, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
     with T.attr(T.iter_var(v3a, None, "DataPar", ""), "pragma_compute_cycles_hint", 209):
         T.evaluate(T.call_extern("ethosu_copy", buffer6[0], 144, p10[0], dtype="handle"))
     with T.attr(T.iter_var(v2c, None, "DataPar", ""), "pragma_compute_cycles_hint", 301):
         T.evaluate(T.call_extern("ethosu_conv2d", "int8", 16, 16, 32, 16, 0, 16, buffer1[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 512, 32, 1, "int8", 16, 16, 2, 16, 0, 16, buffer10[2], 0, 0, 0, T.float32(0.25), 14, "NHWC", 128, 8, 1, 1, 1, 1, 1, 1, 1, p7[0], 112, 12, p7[112], 32, 0, 0, 0, 0, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
     with T.attr(T.iter_var(v4a, None, "DataPar", ""), "pragma_compute_cycles_hint", 213):
         T.evaluate(T.call_extern("ethosu_copy", buffer8[0], 144, p11[0], dtype="handle"))
     with T.attr(T.iter_var(v3c, None, "DataPar", ""), "pragma_compute_cycles_hint", 302):
         T.evaluate(T.call_extern("ethosu_conv2d", "int8", 16, 16, 32, 16, 0, 16, buffer1[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 512, 32, 1, "int8", 16, 16, 2, 16, 0, 16, buffer10[4], 0, 0, 0, T.float32(0.25), 14, "NHWC", 128, 8, 1, 1, 1, 1, 1, 1, 1, p10[0], 112, 12, p10[112], 32, 0, 0, 0, 0, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
     with T.attr(T.iter_var(v4c, None, "DataPar", ""), "pragma_compute_cycles_hint", 303):
         T.evaluate(T.call_extern("ethosu_conv2d", "int8", 16, 16, 32, 16, 0, 16, buffer1[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 512, 32, 1, "int8", 16, 16, 2, 16, 0, 16, buffer10[6], 0, 0, 0, T.float32(0.25), 14, "NHWC", 128, 8, 1, 1, 1, 1, 1, 1, 1, p11[0], 112, 12, p11[112], 32, 0, 0, 0, 0, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
示例#2
0
 def main(placeholder: T.Buffer[(8192,), "int8"], ethosu_write: T.Buffer[(2048,), "int8"]) -> None:
     # function attr dict
     T.func_attr({"from_legacy_te_schedule": True, "global_symbol": "main", "tir.noalias": True})
     buffer = T.buffer_decl([128], "uint8")
     buffer_1 = T.buffer_decl([32], "uint8")
     buffer_2 = T.buffer_decl([112], "uint8")
     buffer_3 = T.buffer_decl([32], "uint8")
     buffer_4 = T.buffer_decl([112], "uint8")
     buffer_5 = T.buffer_decl([32], "uint8")
     buffer_6 = T.buffer_decl([112], "uint8")
     buffer_7 = T.buffer_decl([32], "uint8")
     T.preflattened_buffer(placeholder, [1, 16, 16, 32], "int8", data=placeholder.data)
     T.preflattened_buffer(ethosu_write, [1, 16, 16, 8], "int8", data=ethosu_write.data)
     # body
     p1_global = T.allocate([128], "uint8", "global", annotations={"disable_lower_builtin":True})
     p2_global = T.allocate([32], "uint8", "global", annotations={"disable_lower_builtin":True})
     p1_global_1 = T.buffer_decl([112], dtype="uint8", data=p1_global.data)
     p2_global_1 = T.buffer_decl([32], dtype="uint8", data=p2_global.data)
     T.evaluate(T.call_extern("ethosu_copy", buffer[0], 128, p1_global[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_copy", buffer_1[0], 32, p2_global[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 16, 16, 32, 16, 0, 16, placeholder[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 512, 32, 1, "int8", 16, 16, 2, 16, 0, 16, ethosu_write[0], 0, 0, 0, T.float32(0.25), 14, "NHWC", 128, 8, 1, 1, 1, 1, 1, 1, 1, p1_global[0], 128, 12, p2_global[0], 32, 0, 0, 0, 0, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
     T.evaluate(T.call_extern("ethosu_copy", buffer_2[0], 112, p1_global_1[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_copy", buffer_3[0], 32, p2_global_1[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 16, 16, 32, 16, 0, 16, placeholder[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 512, 32, 1, "int8", 16, 16, 2, 16, 0, 16, ethosu_write[2], 0, 0, 0, T.float32(0.25), 14, "NHWC", 128, 8, 1, 1, 1, 1, 1, 1, 1, p1_global_1[0], 112, 12, p2_global_1[0], 32, 0, 0, 0, 0, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
     T.evaluate(T.call_extern("ethosu_copy", buffer_4[0], 112, p1_global_1[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_copy", buffer_5[0], 32, p2_global_1[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 16, 16, 32, 16, 0, 16, placeholder[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 512, 32, 1, "int8", 16, 16, 2, 16, 0, 16, ethosu_write[4], 0, 0, 0, T.float32(0.25), 14, "NHWC", 128, 8, 1, 1, 1, 1, 1, 1, 1, p1_global_1[0], 112, 12, p2_global_1[0], 32, 0, 0, 0, 0, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
     T.evaluate(T.call_extern("ethosu_copy", buffer_6[0], 112, p1_global_1[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_copy", buffer_7[0], 32, p2_global_1[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 16, 16, 32, 16, 0, 16, placeholder[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 512, 32, 1, "int8", 16, 16, 2, 16, 0, 16, ethosu_write[6], 0, 0, 0, T.float32(0.25), 14, "NHWC", 128, 8, 1, 1, 1, 1, 1, 1, 1, p1_global_1[0], 112, 12, p2_global_1[0], 32, 0, 0, 0, 0, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
示例#3
0
 def main(buffer2: T.Buffer[(128,), "uint8"], buffer3: T.Buffer[(32,), "uint8"], buffer4: T.Buffer[(112,), "uint8"], buffer5: T.Buffer[(32,), "uint8"], buffer6: T.Buffer[(112,), "uint8"], buffer7: T.Buffer[(32,), "uint8"], buffer8: T.Buffer[(112,), "uint8"], buffer9: T.Buffer[(32,), "uint8"]) -> None:
     # function attr dict
     T.func_attr({"from_legacy_te_schedule": True, "global_symbol": "main", "tir.noalias": True})
     buffer1 = T.buffer_decl([8192], "int8")
     buffer10 = T.buffer_decl([2048], "int8")
     # body
     p1 = T.allocate([128], "uint8", "global")
     p2 = T.allocate([112], "uint8", "global")
     p3 = T.allocate([112], "uint8", "global")
     p4 = T.allocate([32], "uint8", "global")
     p5 = T.allocate([32], "uint8", "global")
     p6 = T.allocate([32], "uint8", "global")
     p7 = T.allocate([112], "uint8", "global")
     p8 = T.allocate([3], "uint8", "global")
     T.evaluate(T.call_extern("ethosu_copy", buffer2[0], 128, p1[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_copy", buffer3[0], 32, p4[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_copy", buffer4[0], 112, p2[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_copy", buffer5[0], 32, p5[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 16, 16, 32, 16, 0, 16, buffer1[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 512, 32, 1, "int8", 16, 16, 2, 16, 0, 16, buffer10[0], 0, 0, 0, T.float32(0.25), 14, "NHWC", 128, 8, 1, 1, 1, 1, 1, 1, 1, p1[0], 128, 12, p4[0], 32, 0, 0, 0, 0, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
     T.evaluate(T.call_extern("ethosu_copy", buffer6[0], 112, p3[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_copy", buffer7[0], 32, p6[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 16, 16, 32, 16, 0, 16, buffer1[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 512, 32, 1, "int8", 16, 16, 2, 16, 0, 16, buffer10[2], 0, 0, 0, T.float32(0.25), 14, "NHWC", 128, 8, 1, 1, 1, 1, 1, 1, 1, p2[0], 112, 12, p5[0], 32, 0, 0, 0, 0, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
     T.evaluate(T.call_extern("ethosu_copy", buffer8[0], 112, p7[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_copy", buffer9[0], 32, p8[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 16, 16, 32, 16, 0, 16, buffer1[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 512, 32, 1, "int8", 16, 16, 2, 16, 0, 16, buffer10[4], 0, 0, 0, T.float32(0.25), 14, "NHWC", 128, 8, 1, 1, 1, 1, 1, 1, 1, p3[0], 112, 12, p6[0], 32, 0, 0, 0, 0, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 16, 16, 32, 16, 0, 16, buffer1[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 512, 32, 1, "int8", 16, 16, 2, 16, 0, 16, buffer10[6], 0, 0, 0, T.float32(0.25), 14, "NHWC", 128, 8, 1, 1, 1, 1, 1, 1, 1, p7[0], 112, 12, p8[0], 32, 0, 0, 0, 0, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
示例#4
0
 def main(placeholder_3: T.Buffer[(315,), "int8"], ethosu_write_1: T.Buffer[(240,), "int8"]) -> None:
     # function attr dict
     T.func_attr({"from_legacy_te_schedule": True, "global_symbol": "main", "tir.noalias": True})
     buffer = T.buffer_decl([160], "uint8")
     buffer_1 = T.buffer_decl([656], "uint8")
     T.preflattened_buffer(placeholder_3, [1, 7, 9, 5], 'int8', data=placeholder_3.data)
     T.preflattened_buffer(ethosu_write_1, [1, 3, 5, 16], 'int8', data=ethosu_write_1.data)
     # body
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 3, 5, 3, 3, 0, 5, placeholder_3[146], 0, 0, 0, T.float32(0.5), 10, "NHWC", 45, 5, 1, "int8", 3, 5, 16, 3, 0, 5, ethosu_write_1[0], 0, 0, 0, T.float32(0.25), 14, "NHWC", 80, 16, 1, 3, 3, 1, 1, 1, 1, buffer_1[0], 656, 12, buffer[0], 160, 1, 1, 1, 1, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
示例#5
0
 def main(placeholder_3: T.Buffer[(960,), "int8"], ethosu_write_1: T.Buffer[(1024,), "int8"]) -> None:
     # function attr dict
     T.func_attr({"from_legacy_te_schedule": True, "global_symbol": "main", "tir.noalias": True})
     buffer = T.buffer_decl([848], "uint8")
     buffer_1 = T.buffer_decl([160], "uint8")
     T.preflattened_buffer(placeholder_3, [1, 10, 12, 8], 'int8', data=placeholder_3.data)
     T.preflattened_buffer(ethosu_write_1, [1, 8, 8, 16], 'int8', data=ethosu_write_1.data)
     # body
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 8, 8, 4, 8, 0, 8, placeholder_3[120], 0, 0, 0, T.float32(0.5), 10, "NHWC", 96, 8, 1, "int8", 8, 8, 16, 8, 0, 8, ethosu_write_1[0], 0, 0, 0, T.float32(0.25), 14, "NHWC", 128, 16, 1, 3, 3, 1, 1, 1, 1, buffer[0], 848, T.int8(-1), T.int8(-1), 12, buffer_1[0], 160, T.int8(-1), T.int8(-1), 1, 1, 1, 1, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
示例#6
0
 def main() -> None:
     # function attr dict
     T.func_attr({"from_legacy_te_schedule": True, "global_symbol": "main", "tir.noalias": True})
     placeholder = T.buffer_decl([20], "int8")
     ethosu_write = T.buffer_decl([16], "int8")
     # body
     ethosu_write_4 = T.allocate([16], "int8", "global")
     T.evaluate(T.call_extern("ethosu_binary_elementwise", "int8", 1, 4, 4, 1, 0, 4, placeholder[0], 0, 0, 0, T.float32(0.00783747), -128, "NHWC", 1, 4, 1, "int8", 1, 4, 1, 1, 0, 4, placeholder[16], 0, 0, 0, T.float32(0.00783747), -128, "NHWC", 1, 1, 1, "int8", 1, 4, 4, 1, 0, 4, ethosu_write_4[0], 0, 0, 0, T.float32(0.00783747), -128, "NHWC", 1, 4, 1, "MAX", 0, "CLIP", -128, 127, "TFL", 1, 4, 4, dtype="handle"))
     T.evaluate(T.call_extern("ethosu_identity", "int8", 1, 4, 4, 1, 0, 4, ethosu_write_4[0], 0, 0, 0, T.float32(1), 0, "NHWC", 1, 4, 1, "int8", 1, 4, 4, 1, 0, 4, ethosu_write[0], 0, 0, 0, T.float32(1), 0, "NHWC", 1, 4, 1, "AVG", 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
示例#7
0
 def main(buffer2: T.Buffer[(160,), "uint8"]) -> None:
     # function attr dict
     T.func_attr({"from_legacy_te_schedule": True, "global_symbol": "main", "tir.noalias": True})
     buffer1 = T.buffer_decl([8192], "int8")
     buffer10 = T.buffer_decl([2048], "int8")
     # body
     p4 = T.allocate([160], "uint8", "global")
     T.evaluate(T.call_extern("ethosu_copy", buffer2[0], 160, p4[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 16, 16, 32, 16, 0, 16, buffer1[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 512, 32, 1, "int8", 16, 16, 2, 16, 0, 16, buffer10[0], 0, 0, 0, T.float32(0.25), 14, "NHWC", 128, 8, 1, 1, 1, 1, 1, 1, 1, p4[0], 128, 12, p4[128], 32, 0, 0, 0, 0, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
示例#8
0
 def main(buffer2: T.Buffer[(144,), "uint8"]) -> None:
     T.func_attr({"from_legacy_te_schedule": True, "global_symbol": "main", "tir.noalias": True})  
     buffer0 = T.buffer_decl([390336], "int8")
     buffer1 = T.buffer_decl([97156], "int8")
     buffer6 = T.buffer_decl([390336], "int8")
     # body
     p3 = T.allocate([144], "uint8", "global")
     T.evaluate(T.call_extern("ethosu_pooling", "int8", 214, 227, 2, 214, 0, 227, buffer1[0], 0, 0, 0, T.float32(1), 0, "NHWC", 454, 2, 1, "int8", 214, 114, 2, 214, 0, 114, buffer0[0], 0, 0, 0, T.float32(1), 0, "NHCWB16", 1824, 16, 1, "MAX", 2, 1, 2, 1, 1, 1, 0, 0, 0, 1, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
     T.evaluate(T.call_extern("ethosu_copy", buffer2[0], 144, p3[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 214, 114, 2, 214, 0, 114, buffer0[0], 0, 0, 0, T.float32(0.00392157), -128, "NHCWB16", 1824, 16, 1, "int8", 214, 114, 5, 214, 0, 114, buffer6[0], 0, 0, 0, T.float32(0.0174839), -128, "NHCWB16", 1824, 16, 1, 3, 1, 1, 1, 1, 2, p3[0], 80, 0, p3[80], 64, 0, 1, 0, 1, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
示例#9
0
 def main(placeholder_3: T.Buffer[(8192,), "int8"], ethosu_write_1: T.Buffer[(2048,), "int8"]) -> None:
     # function attr dict
     T.func_attr({"from_legacy_te_schedule": True, "global_symbol": "main", "tir.noalias": True})
     buffer = T.buffer_decl([80], "uint8")
     buffer_1 = T.buffer_decl([304], "uint8")
     T.preflattened_buffer(placeholder_3, [1, 16, 16, 32], dtype="int8", data=placeholder_3.data)
     T.preflattened_buffer(ethosu_write_1, [1, 16, 16, 8], dtype="int8", data=ethosu_write_1.data)
     # body
     placeholder_global = T.allocate([304], "uint8", "global", annotations={"disable_lower_builtin": True})
     placeholder_d_global = T.allocate([80], "uint8", "global", annotations={"disable_lower_builtin": True})
     T.evaluate(T.call_extern("ethosu_copy", buffer_1[0], 304, placeholder_global[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_copy", buffer[0], 80, placeholder_d_global[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 16, 16, 32, 16, 0, 16, placeholder_3[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 512, 32, 1, "int8", 16, 16, 8, 16, 0, 16, ethosu_write_1[0], 0, 0, 0, T.float32(0.25), 14, "NHWC", 128, 8, 1, 1, 1, 1, 1, 1, 1, placeholder_global[0], 304, T.int8(-1), T.int8(-1), 12, placeholder_d_global[0], 80, T.int8(-1), T.int8(-1), 0, 0, 0, 0, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
示例#10
0
 def main(placeholder: T.Buffer[(1024,), "int8"], ethosu_write: T.Buffer[(32768,), "int8"]) -> None:
     # function attr dict
     T.func_attr({"from_legacy_te_schedule": True, "global_symbol": "main", "tir.noalias": True})
     buffer = T.buffer_decl([1456], "uint8")
     buffer_1 = T.buffer_decl([352], "uint8")
     buffer_2 = T.buffer_decl([11040], "uint8")
     buffer_3 = T.buffer_decl([272], "uint8")
     T.preflattened_buffer(placeholder, [1, 8, 1, 8, 16], 'int8', data=placeholder.data)
     T.preflattened_buffer(ethosu_write, [1, 32, 2, 32, 16], 'int8', data=ethosu_write.data)
     # body
     ethosu_write_1 = T.allocate([12288], "int8", "global", annotations={"disable_lower_builtin":True})
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 8, 8, 3, 8, 0, 8, placeholder[0], 0, 0, 0, T.float32(0.5), 10, "NHCWB16", 128, 16, 1, "int8", 16, 16, 35, 16, 0, 16, ethosu_write_1[0], 0, 0, 0, T.float32(0.25), 14, "NHCWB16", 768, 16, 256, 3, 3, 1, 1, 1, 1, buffer[0], 1456, 12, buffer_1[0], 352, 1, 1, 1, 1, "NONE", 0, 0, "TFL", "NEAREST", 0, 0, 0, dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 16, 16, 35, 16, 0, 16, ethosu_write_1[0], 0, 0, 0, T.float32(0.5), 10, "NHCWB16", 768, 16, 256, "int8", 32, 32, 26, 32, 0, 32, ethosu_write[0], 0, 0, 0, T.float32(0.25), 14, "NHCWB16", 1024, 16, 512, 3, 3, 1, 1, 1, 1, buffer_2[0], 11040, 12, buffer_3[0], 272, 1, 1, 1, 1, "NONE", 0, 0, "TFL", "NEAREST", 0, 0, 0, dtype="handle"))
示例#11
0
 def main(placeholder_5: T.Buffer[(1024,), "int8"], ethosu_write_1: T.Buffer[(2048,), "int8"]) -> None:
     # function attr dict
     T.func_attr({"from_legacy_te_schedule": True, "global_symbol": "main", "tir.noalias": True})
     buffer = T.buffer_decl([1456], "uint8")
     buffer_1 = T.buffer_decl([352], "uint8")
     buffer_2 = T.buffer_decl([272], "uint8")
     buffer_3 = T.buffer_decl([11040], "uint8")
     T.preflattened_buffer(placeholder_5, [1, 8, 1, 8, 16], 'int8', data=placeholder_5.data)
     T.preflattened_buffer(ethosu_write_1, [1, 8, 2, 8, 16], 'int8', data=ethosu_write_1.data)
     # body
     ethosu_write_2 = T.allocate([2304], "int8", "global", annotations={"disable_lower_builtin": True})
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 6, 8, 3, 6, 0, 8, placeholder_5[0], 0, 0, 0, T.float32(0.5), 10, "NHCWB16", 128, 16, 1, "int8", 5, 8, 35, 5, 0, 8, ethosu_write_2[384], 0, 0, 0, T.float32(0.25), 14, "NHCWB16", 384, 16, 128, 3, 3, 1, 1, 1, 1, buffer[0], 1456, T.int8(-1), T.int8(-1), 12, buffer_1[0], 352, T.int8(-1), T.int8(-1), 1, 1, 0, 1, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 5, 8, 35, 5, 0, 8, ethosu_write_2[384], 0, 0, 0, T.float32(0.5), 10, "NHCWB16", 384, 16, 128, "int8", 4, 8, 26, 4, 0, 8, ethosu_write_1[0], 0, 0, 0, T.float32(0.25), 14, "NHCWB16", 256, 16, 128, 3, 3, 1, 1, 1, 1, buffer_3[0], 11040, T.int8(-1), T.int8(-1), 12, buffer_2[0], 272, T.int8(-1), T.int8(-1), 1, 1, 0, 1, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 6, 8, 3, 6, 0, 8, placeholder_5[256], 0, 0, 0, T.float32(0.5), 10, "NHCWB16", 128, 16, 1, "int8", 5, 8, 35, 5, 0, 8, ethosu_write_2[0], 0, 0, 0, T.float32(0.25), 14, "NHCWB16", 384, 16, 128, 3, 3, 1, 1, 1, 1, buffer[0], 1456, T.int8(-1), T.int8(-1), 12, buffer_1[0], 352, T.int8(-1), T.int8(-1), 0, 1, 1, 1, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 5, 8, 35, 5, 0, 8, ethosu_write_2[0], 0, 0, 0, T.float32(0.5), 10, "NHCWB16", 384, 16, 128, "int8", 4, 8, 26, 4, 0, 8, ethosu_write_1[1024], 0, 0, 0, T.float32(0.25), 14, "NHCWB16", 256, 16, 128, 3, 3, 1, 1, 1, 1, buffer_3[0], 11040, T.int8(-1), T.int8(-1), 12, buffer_2[0], 272, T.int8(-1), T.int8(-1), 0, 1, 1, 1, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
示例#12
0
 def main(placeholder_5: T.Buffer[(192,), "int8"], ethosu_write_1: T.Buffer[(512,), "int8"]) -> None:
     # function attr dict
     T.func_attr({"from_legacy_te_schedule": True, "global_symbol": "main", "tir.noalias": True})
     buffer = T.buffer_decl([80], "uint8")
     buffer_1 = T.buffer_decl([320], "uint8")
     buffer_2 = T.buffer_decl([1312], "uint8")
     buffer_3 = T.buffer_decl([2608], "uint8")
     T.preflattened_buffer(placeholder_5, [1, 8, 8, 3], 'int8', data=placeholder_5.data)
     T.preflattened_buffer(ethosu_write_1, [1, 8, 8, 8], 'int8', data=ethosu_write_1.data)
     # body
     ethosu_write_2 = T.allocate([1536], "int8", "global", annotations={"disable_lower_builtin": True})
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 6, 8, 3, 6, 0, 8, placeholder_5[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 24, 3, 1, "int8", 5, 8, 32, 5, 0, 8, ethosu_write_2[256], 0, 0, 0, T.float32(0.25), 14, "NHWC", 256, 32, 1, 3, 3, 1, 1, 1, 1, buffer_2[0], 1312, 12, buffer_1[0], 320, 1, 1, 0, 1, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 5, 8, 32, 5, 0, 8, ethosu_write_2[256], 0, 0, 0, T.float32(0.5), 10, "NHWC", 256, 32, 1, "int8", 4, 8, 8, 4, 0, 8, ethosu_write_1[0], 0, 0, 0, T.float32(0.25), 14, "NHWC", 64, 8, 1, 3, 3, 1, 1, 1, 1, buffer_3[0], 2608, 12, buffer[0], 80, 1, 1, 0, 1, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 6, 8, 3, 6, 0, 8, placeholder_5[48], 0, 0, 0, T.float32(0.5), 10, "NHWC", 24, 3, 1, "int8", 5, 8, 32, 5, 0, 8, ethosu_write_2[0], 0, 0, 0, T.float32(0.25), 14, "NHWC", 256, 32, 1, 3, 3, 1, 1, 1, 1, buffer_2[0], 1312, 12, buffer_1[0], 320, 0, 1, 1, 1, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 5, 8, 32, 5, 0, 8, ethosu_write_2[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 256, 32, 1, "int8", 4, 8, 8, 4, 0, 8, ethosu_write_1[256], 0, 0, 0, T.float32(0.25), 14, "NHWC", 64, 8, 1, 3, 3, 1, 1, 1, 1, buffer_3[0], 2608, 12, buffer[0], 80, 0, 1, 1, 1, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
示例#13
0
 def main(placeholder: T.Buffer[(192,), "int8"], ethosu_write: T.Buffer[(8192,), "int8"]) -> None:
     # function attr dict
     T.func_attr({"from_legacy_te_schedule": True, "global_symbol": "main", "tir.noalias": True})
     buffer = T.buffer_decl([160], "uint8")
     buffer_1 = T.buffer_decl([320], "uint8")
     buffer_2 = T.buffer_decl([304], "uint8")
     buffer_3 = T.buffer_decl([80], "uint8")
     T.preflattened_buffer(placeholder, [1, 8, 8, 3], 'int8', data=placeholder.data)
     T.preflattened_buffer(ethosu_write, [1, 32, 32, 8], 'int8', data=ethosu_write.data)
     # body
     ethosu_write_1 = T.allocate([4096], "int8", "global", annotations={"disable_lower_builtin":True})
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 4, 8, 3, 4, 0, 8, placeholder[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 24, 3, 1, "int8", 8, 16, 32, 8, 0, 16, ethosu_write_1[0], 0, 0, 0, T.float32(0.25), 14, "NHWC", 512, 32, 1, 1, 1, 1, 1, 1, 1, buffer[0], 160, 12, buffer_1[0], 320, 0, 0, 0, 0, "NONE", 0, 0, "TFL", "ZEROS", 0, 0, 0, dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 8, 16, 32, 8, 0, 16, ethosu_write_1[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 512, 32, 1, "int8", 16, 32, 8, 16, 0, 32, ethosu_write[0], 0, 0, 0, T.float32(0.25), 14, "NHWC", 256, 8, 1, 1, 1, 1, 1, 1, 1, buffer_2[0], 304, 12, buffer_3[0], 80, 0, 0, 0, 0, "NONE", 0, 0, "TFL", "ZEROS", 0, 0, 0, dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 4, 8, 3, 4, 0, 8, placeholder[96], 0, 0, 0, T.float32(0.5), 10, "NHWC", 24, 3, 1, "int8", 8, 16, 32, 8, 0, 16, ethosu_write_1[0], 0, 0, 0, T.float32(0.25), 14, "NHWC", 512, 32, 1, 1, 1, 1, 1, 1, 1, buffer[0], 160, 12, buffer_1[0], 320, 0, 0, 0, 0, "NONE", 0, 0, "TFL", "ZEROS", 0, 0, 0, dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 8, 16, 32, 8, 0, 16, ethosu_write_1[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 512, 32, 1, "int8", 16, 32, 8, 16, 0, 32, ethosu_write[4096], 0, 0, 0, T.float32(0.25), 14, "NHWC", 256, 8, 1, 1, 1, 1, 1, 1, 1, buffer_2[0], 304, 12, buffer_3[0], 80, 0, 0, 0, 0, "NONE", 0, 0, "TFL", "ZEROS", 0, 0, 0, dtype="handle"))
def func_distributivity_expected(i1: T.int32, i2: T.int32, x: T.int32,
                                 y: T.int32, z: T.int32) -> None:
    B = T.buffer_decl((50, ), "int32")
    cse_var_1 = T.var("int32")
    with T.let(cse_var_1, x * y + x * z):
        B[i1] = cse_var_1
        B[i2] = cse_var_1
示例#15
0
 def main(A: T.handle, tensor: T.handle) -> None:
     # function attr dict
     T.func_attr({"from_legacy_te_schedule": True, "global_symbol": "main", "tir.noalias": True})
     # buffer definition
     tensor_2 = T.buffer_decl([1, 10, 12, 16], dtype="int8", elem_offset=0, align=128, offset_factor=1)
     A_1 = T.match_buffer(A, [1, 12, 14, 16], dtype="int8", elem_offset=0, align=128, offset_factor=1)
     tensor_1 = T.match_buffer(tensor, [1, 8, 8, 16], dtype="int8", elem_offset=0, align=128, offset_factor=1)
     # body
     T.realize(tensor_1[0:1, 0:8, 0:8, 0:16], "")
     T.realize(tensor_2[0:1, 0:6, 0:12, 0:16], "")
     for ax1_outer in T.serial(0, 2):
         for ax1 in T.serial(0, 6):
             for ax2 in T.serial(0, 12):
                 for ax3 in T.serial(0, 16):
                     if T.likely(((ax1_outer < 1) or (ax1 >= 2)), dtype='bool') :
                         tensor_2[0, T.floormod((ax1 + (ax1_outer*4)), 6), ax2, ax3] = T.int8(0)
                     for dh in T.serial(0, 3):
                         for dw in T.serial(0, 3):
                             if T.likely(((ax1_outer < 1) or (ax1 >= 2)), dtype='bool'):
                                 tensor_2[0, T.floormod((ax1 + (ax1_outer*4)), 6), ax2, ax3] = T.max(tensor_2[0, T.floormod((ax1 + (ax1_outer*4)), 6), ax2, ax3], A_1[0, ((ax1 + (ax1_outer*4)) + dh), (ax2 + dw), ax3])
         for ax1_inner in T.serial(0, 4):
             for ax2_inner in T.serial(0, 8):
                 for ax3_inner in T.serial(0, 16):
                     tensor_1[0, (ax1_inner + (ax1_outer*4)), ax2_inner, ax3_inner] = T.int8(0)
                     for dh_1 in T.serial(0, 3):
                         for dw_1 in T.serial(0, 5):
                             tensor_1[0, (ax1_inner + (ax1_outer*4)), ax2_inner, ax3_inner] = T.max(tensor_1[0, (ax1_inner + (ax1_outer*4)), ax2_inner, ax3_inner], tensor_2[0, T.floormod(((ax1_inner + (ax1_outer*4)) + dh_1), 6), (ax2_inner + dw_1), ax3_inner])
def func_associativity_expected(i1: T.int32, i2: T.int32, x: T.int32,
                                y: T.int32, z: T.int32) -> None:
    B = T.buffer_decl((50, ), "int32")
    cse_var_1 = T.var("int32")
    with T.let(cse_var_1, (x + y) + z):
        B[i1] = cse_var_1
        B[i2] = cse_var_1
        def main():
            T.func_attr({"from_legacy_te_schedule": True})

            # If a pointer defined using a LetStmt,
            A_data: T.Ptr[T.int32] = T.call_extern("dummy_extern_function", dtype="handle")

            # and a buffer is backed by that pointer,
            A: T.Buffer = T.buffer_decl([1], dtype="float32", data=A_data)
            T.evaluate(A[0])
示例#18
0
 def main(placeholder_5: T.Buffer[(8192,), "int8"], ethosu_write_1: T.Buffer[(4096,), "int8"]) -> None:
     # function attr dict
     T.func_attr({"from_legacy_te_schedule": True, "global_symbol": "main", "tir.noalias": True})
     buffer = T.buffer_decl([416], "uint8")
     buffer_1 = T.buffer_decl([112], "uint8")
     buffer_2 = T.buffer_decl([272], "uint8")
     buffer_3 = T.buffer_decl([64], "uint8")
     T.preflattened_buffer(placeholder_5, [1, 16, 16, 32], dtype="int8", data=placeholder_5.data)
     T.preflattened_buffer(ethosu_write_1, [1, 16, 16, 16], dtype="int8", data=ethosu_write_1.data)
     # body
     placeholder_global_unrolled_iter_0 = T.allocate([416], "uint8", "global", annotations={"disable_lower_builtin": True})
     placeholder_d_global_unrolled_iter_0 = T.allocate([112], "uint8", "global", annotations={"disable_lower_builtin": True})
     placeholder_global_unrolled_iter_1 = T.allocate([272], "uint8", "global", annotations={"disable_lower_builtin": True})
     placeholder_d_global_unrolled_iter_1 = T.allocate([64],  "uint8", "global", annotations={"disable_lower_builtin": True})
     T.evaluate(T.call_extern("ethosu_copy", buffer[0], 416, placeholder_global_unrolled_iter_0[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_copy", buffer_1[0], 112, placeholder_d_global_unrolled_iter_0[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_copy", buffer_2[0], 272, placeholder_global_unrolled_iter_1[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_copy", buffer_3[0], 64, placeholder_d_global_unrolled_iter_1[0], dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 16, 16, 32, 16, 0, 16, placeholder_5[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 512, 32, 1, "int8", 16, 16, 10, 16, 0, 16, ethosu_write_1[0], 0, 0, 0, T.float32(0.25), 14, "NHWC", 256, 16, 1, 1, 1, 1, 1, 1, 1, placeholder_global_unrolled_iter_0[0], 416, T.int8(-1), T.int8(-1), 12, placeholder_d_global_unrolled_iter_0[0], 112, T.int8(-1), T.int8(-1), 0, 0, 0, 0, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 16, 16, 32, 16, 0, 16, placeholder_5[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 512, 32, 1, "int8", 16, 16, 6, 16, 0, 16, ethosu_write_1[10], 0, 0, 0, T.float32(0.25), 14, "NHWC", 256, 16, 1, 1, 1, 1, 1, 1, 1, placeholder_global_unrolled_iter_1[0], 272, T.int8(-1), T.int8(-1), 12, placeholder_d_global_unrolled_iter_1[0], 64, T.int8(-1), T.int8(-1), 0, 0, 0, 0, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
示例#19
0
def strided_buffer_func(a: T.handle, c: T.handle) -> None:
    A = T.match_buffer(a, (16, 16), "float32")
    C = T.match_buffer(c, (16, 16), "float32")
    for i0 in T.serial(4):
        B = T.allocate([4, 17], "float32", "global")
        B_1 = T.buffer_decl([4, 16],
                            dtype="float32",
                            data=B.data,
                            strides=[17, 1])
        for i1, j in T.grid(4, 16):
            B_1[i1, j] = A[i0 * 4 + i1, j] + 1.0
        for i1, j in T.grid(4, 16):
            C[i0 * 4 + i1, j] = B_1[i1, j] * 2.0
示例#20
0
def transformed_strided_buffer_func(A: T.Buffer[(16, 16), "float32"],
                                    C: T.Buffer[(16, 16), "float32"]) -> None:
    # body
    for i0 in T.serial(4):
        B = T.allocate([4, 17], "float32", "global")
        B_1 = T.buffer_decl([4, 16],
                            dtype="float32",
                            data=B.data,
                            strides=[17, 1])
        for i1, j in T.grid(4, 16):
            B_1[i1, j] = A[i0 * 4 + i1, j] + T.float32(1)
        for i1, j in T.grid(4, 16):
            C[i0 * 4 + i1, j] = B_1[i1, j] * T.float32(2)
示例#21
0
 def main(placeholder: T.Buffer[(1536,), "int8"], placeholder_1: T.Buffer[(1280,), "int8"], T_concat: T.Buffer[(4096,), "int8"]) -> None:
     # function attr dict
     T.func_attr({"from_legacy_te_schedule": True, "global_symbol": "main", "tir.noalias": True})
     buffer = T.buffer_decl([2992], "uint8")
     buffer_1 = T.buffer_decl([160], "uint8")
     buffer_2 = T.buffer_decl([2992], "uint8")
     buffer_3 = T.buffer_decl([160], "uint8")
     buffer_4 = T.buffer_decl([2992], "uint8")
     buffer_5 = T.buffer_decl([160], "uint8")
     buffer_6 = T.buffer_decl([2992], "uint8")
     buffer_7 = T.buffer_decl([160], "uint8")
     T.preflattened_buffer(placeholder, [1, 8, 12, 16], "int8", data=placeholder.data)
     T.preflattened_buffer(placeholder_1, [1, 8, 10, 16], "int8", data=placeholder_1.data)
     T.preflattened_buffer(T_concat, [1, 8, 32, 16], "int8", data=T_concat.data)
     # body
     T_concat_1 = T.allocate([2816], "int8", "global", annotations={"disable_lower_builtin":True})
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 8, 10, 16, 8, 0, 10, placeholder_1[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 160, 16, 1, "int8", 8, 10, 16, 8, 0, 10, T_concat_1[192], 0, 0, 0, T.float32(0.25), 14, "NHWC", 352, 16, 1, 3, 3, 1, 1, 1, 1, buffer[0], 2992, 12, buffer_1[0], 160, 1, 1, 1, 1, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 8, 10, 16, 8, 0, 10, T_concat_1[192], 0, 0, 0, T.float32(0.5), 10, "NHWC", 352, 16, 1, "int8", 8, 10, 16, 8, 0, 10, T_concat[352], 0, 0, 0, T.float32(0.25), 14, "NHWC", 512, 16, 1, 3, 3, 1, 1, 1, 1, buffer_2[0], 2992, 12, buffer_3[0], 160, 1, 1, 1, 1, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 8, 12, 16, 8, 0, 12, placeholder[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 192, 16, 1, "int8", 8, 12, 16, 8, 0, 12, T_concat_1[0], 0, 0, 0, T.float32(0.25), 14, "NHWC", 352, 16, 1, 3, 3, 1, 1, 1, 1, buffer_4[0], 2992, 12, buffer_5[0], 160, 1, 1, 1, 1, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 8, 22, 16, 8, 0, 22, T_concat_1[0], 0, 0, 0, T.float32(0.5), 10, "NHWC", 352, 16, 1, "int8", 8, 22, 16, 8, 0, 22, T_concat[0], 0, 0, 0, T.float32(0.25), 14, "NHWC", 512, 16, 1, 3, 3, 1, 1, 1, 1, buffer_6[0], 2992, 12, buffer_7[0], 160, 1, 1, 1, 1, "NONE", 0, 0, "TFL", "NONE", 0, 0, 0, dtype="handle"))
def func_distributivity(i1: T.int32, i2: T.int32, x: T.int32, y: T.int32,
                        z: T.int32) -> None:
    B = T.buffer_decl((50, ), "int32")
    B[i1] = x * (y + z)
    B[i2] = x * y + x * z
def func_associativity(i1: T.int32, i2: T.int32, x: T.int32, y: T.int32,
                       z: T.int32) -> None:
    B = T.buffer_decl((50, ), "int32")
    B[i1] = (x + y) + z
    B[i2] = x + (y + z)
示例#24
0
 def main(placeholder: T.Buffer[(301056, ), "int8"],
          ethosu_write: T.Buffer[(75264, ), "int8"]) -> None:
     T.func_attr({
         "from_legacy_te_schedule": True,
         "global_symbol": "main",
         "tir.noalias": True
     })
     T.preflattened_buffer(placeholder, [1, 56, 56, 96],
                           dtype='int8',
                           data=placeholder.data)
     T.preflattened_buffer(ethosu_write, [1, 56, 56, 24],
                           dtype='int8',
                           data=ethosu_write.data)
     buffer1 = T.buffer_decl([2608], "uint8")
     buffer2 = T.buffer_decl([240], "uint8")
     buffer3 = T.buffer_decl([736], "uint8")
     buffer4 = T.buffer_decl([240], "uint8")
     p1 = T.allocate([2608],
                     "uint8",
                     "global",
                     annotations={"disable_lower_builtin": True})
     p2 = T.allocate([240],
                     "uint8",
                     "global",
                     annotations={"disable_lower_builtin": True})
     p3 = T.allocate([736],
                     "uint8",
                     "global",
                     annotations={"disable_lower_builtin": True})
     p4 = T.allocate([240],
                     "uint8",
                     "global",
                     annotations={"disable_lower_builtin": True})
     p5 = T.allocate([75264],
                     "int8",
                     "global",
                     annotations={"disable_lower_builtin": True})
     p6 = T.allocate([75264],
                     "int8",
                     "global",
                     annotations={"disable_lower_builtin": True})
     T.evaluate(
         T.call_extern("ethosu_copy",
                       buffer1[0],
                       2608,
                       p1[0],
                       dtype="handle"))
     T.evaluate(
         T.call_extern("ethosu_copy",
                       buffer2[0],
                       240,
                       p2[0],
                       dtype="handle"))
     T.evaluate(
         T.call_extern("ethosu_copy",
                       buffer3[0],
                       736,
                       p3[0],
                       dtype="handle"))
     T.evaluate(
         T.call_extern("ethosu_copy",
                       buffer4[0],
                       240,
                       p4[0],
                       dtype="handle"))
     T.evaluate(
         T.call_extern("ethosu_conv2d",
                       "int8",
                       56,
                       56,
                       96,
                       56,
                       0,
                       56,
                       placeholder[0],
                       0,
                       0,
                       0,
                       T.float32(0.5),
                       10,
                       "NHWC",
                       5376,
                       96,
                       1,
                       "int8",
                       56,
                       56,
                       24,
                       56,
                       0,
                       56,
                       p5[0],
                       0,
                       0,
                       0,
                       T.float32(0.25),
                       14,
                       "NHWC",
                       1344,
                       24,
                       1,
                       1,
                       1,
                       1,
                       1,
                       1,
                       1,
                       p1[0],
                       2608,
                       T.int8(-1),
                       T.int8(-1),
                       12,
                       p2[0],
                       240,
                       T.int8(-1),
                       T.int8(-1),
                       0,
                       0,
                       0,
                       0,
                       "NONE",
                       0,
                       0,
                       "TFL",
                       "NONE",
                       0,
                       0,
                       0,
                       dtype="handle"))
     T.evaluate(
         T.call_extern("ethosu_conv2d",
                       "int8",
                       56,
                       56,
                       24,
                       56,
                       0,
                       56,
                       p5[0],
                       0,
                       0,
                       0,
                       T.float32(0.5),
                       10,
                       "NHWC",
                       1344,
                       24,
                       1,
                       "int8",
                       56,
                       56,
                       24,
                       56,
                       0,
                       56,
                       p6[0],
                       0,
                       0,
                       0,
                       T.float32(0.25),
                       14,
                       "NHWC",
                       1344,
                       24,
                       1,
                       1,
                       1,
                       1,
                       1,
                       1,
                       1,
                       p3[0],
                       736,
                       T.int8(-1),
                       T.int8(-1),
                       12,
                       p4[0],
                       240,
                       T.int8(-1),
                       T.int8(-1),
                       0,
                       0,
                       0,
                       0,
                       "NONE",
                       0,
                       0,
                       "TFL",
                       "NONE",
                       0,
                       0,
                       0,
                       dtype="handle"))
     T.evaluate(
         T.call_extern("ethosu_binary_elementwise",
                       "int8",
                       56,
                       56,
                       24,
                       56,
                       0,
                       56,
                       p5[0],
                       0,
                       0,
                       0,
                       T.float32(1),
                       0,
                       "NHWC",
                       1344,
                       24,
                       1,
                       "int8",
                       56,
                       56,
                       24,
                       56,
                       0,
                       56,
                       p6[0],
                       0,
                       0,
                       0,
                       T.float32(1),
                       0,
                       "NHWC",
                       1344,
                       24,
                       1,
                       "int8",
                       56,
                       56,
                       24,
                       56,
                       0,
                       56,
                       ethosu_write[0],
                       0,
                       0,
                       0,
                       T.float32(1),
                       0,
                       "NHWC",
                       1344,
                       24,
                       1,
                       "ADD",
                       0,
                       "NONE",
                       0,
                       0,
                       "TFL",
                       0,
                       0,
                       0,
                       dtype="handle"))
示例#25
0
    def main(input_buffer: T.Buffer[(301056, ), "int8"],
             output_buffer: T.Buffer[(75264, ), "int8"]) -> None:
        T.func_attr({
            "from_legacy_te_schedule": True,
            "global_symbol": "main",
            "tir.noalias": True
        })
        T.preflattened_buffer(input_buffer, [1, 56, 56, 96],
                              dtype='int8',
                              data=input_buffer.data)
        T.preflattened_buffer(output_buffer, [1, 56, 56, 24],
                              dtype='int8',
                              data=output_buffer.data)

        weight_buffer = T.buffer_decl([2608], "uint8")
        bias_buffer = T.buffer_decl([240], "uint8")
        weight_buffer2 = T.buffer_decl([736], "uint8")
        bias_buffer2 = T.buffer_decl([240], "uint8")

        weight_global = T.allocate([2608],
                                   "uint8",
                                   "global",
                                   annotations={"disable_lower_builtin": True})
        weight_global2 = T.buffer_decl([736], "uint8", data=weight_global.data)
        bias_global = T.allocate([240],
                                 "uint8",
                                 "global",
                                 annotations={"disable_lower_builtin": True})
        featuremap_buffer = T.allocate(
            [75264],
            "int8",
            "global",
            annotations={"disable_lower_builtin": True})
        featuremap_buffer2 = T.allocate(
            [75264],
            "int8",
            "global",
            annotations={"disable_lower_builtin": True})

        T.evaluate(
            T.call_extern("ethosu_copy",
                          weight_buffer[0],
                          2608,
                          weight_global[0],
                          dtype="handle"))
        T.evaluate(
            T.call_extern("ethosu_copy",
                          bias_buffer[0],
                          240,
                          bias_global[0],
                          dtype="handle"))
        T.evaluate(
            T.call_extern("ethosu_conv2d",
                          "int8",
                          56,
                          56,
                          96,
                          56,
                          0,
                          56,
                          input_buffer[0],
                          0,
                          0,
                          0,
                          T.float32(0.5),
                          10,
                          "NHWC",
                          5376,
                          96,
                          1,
                          "int8",
                          56,
                          56,
                          24,
                          56,
                          0,
                          56,
                          featuremap_buffer[0],
                          0,
                          0,
                          0,
                          T.float32(0.25),
                          14,
                          "NHWC",
                          1344,
                          24,
                          1,
                          1,
                          1,
                          1,
                          1,
                          1,
                          1,
                          weight_global[0],
                          2608,
                          12,
                          bias_global[0],
                          240,
                          0,
                          0,
                          0,
                          0,
                          "NONE",
                          0,
                          0,
                          "TFL",
                          "NONE",
                          0,
                          0,
                          0,
                          dtype="handle"))
        T.evaluate(
            T.call_extern("ethosu_copy",
                          weight_buffer2[0],
                          736,
                          weight_global2[0],
                          dtype="handle"))
        T.evaluate(
            T.call_extern("ethosu_copy",
                          bias_buffer2[0],
                          240,
                          bias_global[0],
                          dtype="handle"))
        T.evaluate(
            T.call_extern("ethosu_conv2d",
                          "int8",
                          56,
                          56,
                          24,
                          56,
                          0,
                          56,
                          featuremap_buffer[0],
                          0,
                          0,
                          0,
                          T.float32(0.5),
                          10,
                          "NHWC",
                          1344,
                          24,
                          1,
                          "int8",
                          56,
                          56,
                          24,
                          56,
                          0,
                          56,
                          featuremap_buffer2[0],
                          0,
                          0,
                          0,
                          T.float32(0.25),
                          14,
                          "NHWC",
                          1344,
                          24,
                          1,
                          1,
                          1,
                          1,
                          1,
                          1,
                          1,
                          weight_global2[0],
                          736,
                          12,
                          bias_global[0],
                          240,
                          0,
                          0,
                          0,
                          0,
                          "NONE",
                          0,
                          0,
                          "TFL",
                          "NONE",
                          0,
                          0,
                          0,
                          dtype="handle"))
        T.evaluate(
            T.call_extern("ethosu_binary_elementwise",
                          "int8",
                          56,
                          56,
                          24,
                          56,
                          0,
                          56,
                          featuremap_buffer[0],
                          0,
                          0,
                          0,
                          T.float32(1),
                          0,
                          "NHWC",
                          1344,
                          24,
                          1,
                          "int8",
                          56,
                          56,
                          24,
                          56,
                          0,
                          56,
                          featuremap_buffer2[0],
                          0,
                          0,
                          0,
                          T.float32(1),
                          0,
                          "NHWC",
                          1344,
                          24,
                          1,
                          "int8",
                          56,
                          56,
                          24,
                          56,
                          0,
                          56,
                          output_buffer[0],
                          0,
                          0,
                          0,
                          T.float32(1),
                          0,
                          "NHWC",
                          1344,
                          24,
                          1,
                          "ADD",
                          0,
                          "NONE",
                          0,
                          0,
                          "TFL",
                          0,
                          0,
                          0,
                          dtype="handle"))
示例#26
0
 def before() -> None:
     A_data: T.Ptr[T.int32] = T.call_extern("dummy_func", dtype="handle")
     A = T.buffer_decl([8], "int32", data=A_data)
     A[0:8] = T.broadcast(42, 8)
示例#27
0
 def expected() -> None:
     A_data: T.Ptr[T.int32x8] = T.call_extern("dummy_func", dtype="handle")
     A = T.buffer_decl([1], "int32x8", data=A_data)
     A[0] = T.broadcast(42, 8)