Beispiel #1
0
 def main(placeholder_3: T.Buffer[(1, 16, 16, 32), "int8"], ethosu_write_1: T.Buffer[(1, 16, 16, 8), "int8"]) -> None:
     # function attr dict
     T.func_attr({"from_legacy_te_schedule": True, "global_symbol": "main", "tir.noalias": True})
     buffer = T.buffer_var("uint8", "")
     buffer_1 = T.buffer_var("uint8", "")
     # 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", T.load("uint8", buffer_1, 0), 304, T.load("uint8", placeholder_global, 0), dtype="handle"))
     T.evaluate(T.call_extern("ethosu_copy", T.load("uint8", buffer, 0), 80, T.load("uint8", placeholder_d_global, 0), dtype="handle"))
     T.evaluate(T.call_extern("ethosu_conv2d", "int8", 16, 16, 32, 16, 0, 16, T.load("int8", placeholder_3.data, 0), 0, 0, 0, T.float32(0.5), 10, "NHWC", 512, 32, 1, "int8", 16, 16, 8, 16, 0, 16, T.load("int8", ethosu_write_1.data, 0), 0, 0, 0, T.float32(0.25), 14, "NHWC", 128, 8, 1, 1, 1, 1, 1, 1, 1, T.load("uint8", placeholder_global, 0), 304, 12, T.load("uint8", placeholder_d_global, 0), 80, 0, 0, 0, 0, "NONE", 0, 0, "TFL", "NONE", dtype="handle"))
Beispiel #2
0
    def main(input_buffer: T.Buffer[(1, 56, 56, 96), "int8"],
             output_buffer: T.Buffer[(1, 56, 56, 24), "int8"]) -> None:
        T.func_attr({
            "from_legacy_te_schedule": True,
            "global_symbol": "main",
            "tir.noalias": True
        })
        weight_buffer = T.buffer_var("uint8", "")
        bias_buffer = T.buffer_var("uint8", "")
        weight_buffer2 = T.buffer_var("uint8", "")
        bias_buffer2 = T.buffer_var("uint8", "")

        placeholder_global = T.allocate(
            [2608],
            "uint8",
            "global",
            annotations={"disable_lower_builtin": True})
        placeholder_d_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",
                          T.load("uint8", weight_buffer, 0),
                          2608,
                          T.load("uint8", placeholder_global, 0),
                          dtype="handle"))
        T.evaluate(
            T.call_extern("ethosu_copy",
                          T.load("uint8", bias_buffer, 0),
                          240,
                          T.load("uint8", placeholder_d_global, 0),
                          dtype="handle"))
        T.evaluate(
            T.call_extern("ethosu_conv2d",
                          "int8",
                          56,
                          56,
                          96,
                          56,
                          0,
                          56,
                          T.load("int8", input_buffer.data, 0),
                          0,
                          0,
                          0,
                          T.float32(0.5),
                          10,
                          "NHWC",
                          5376,
                          96,
                          1,
                          "int8",
                          56,
                          56,
                          24,
                          56,
                          0,
                          56,
                          T.load("int8", featuremap_buffer, 0),
                          0,
                          0,
                          0,
                          T.float32(0.25),
                          14,
                          "NHWC",
                          1344,
                          24,
                          1,
                          1,
                          1,
                          1,
                          1,
                          1,
                          1,
                          T.load("uint8", placeholder_global, 0),
                          2608,
                          12,
                          T.load("uint8", placeholder_d_global, 0),
                          240,
                          0,
                          0,
                          0,
                          0,
                          "NONE",
                          0,
                          0,
                          "TFL",
                          "NONE",
                          dtype="handle"))
        T.evaluate(
            T.call_extern("ethosu_copy",
                          T.load("uint8", weight_buffer2, 0),
                          736,
                          T.load("uint8", placeholder_global, 0),
                          dtype="handle"))
        T.evaluate(
            T.call_extern("ethosu_copy",
                          T.load("uint8", bias_buffer2, 0),
                          240,
                          T.load("uint8", placeholder_d_global, 0),
                          dtype="handle"))
        T.evaluate(
            T.call_extern("ethosu_conv2d",
                          "int8",
                          56,
                          56,
                          24,
                          56,
                          0,
                          56,
                          T.load("int8", featuremap_buffer, 0),
                          0,
                          0,
                          0,
                          T.float32(0.5),
                          10,
                          "NHWC",
                          1344,
                          24,
                          1,
                          "int8",
                          56,
                          56,
                          24,
                          56,
                          0,
                          56,
                          T.load("int8", featuremap_buffer2, 0),
                          0,
                          0,
                          0,
                          T.float32(0.25),
                          14,
                          "NHWC",
                          1344,
                          24,
                          1,
                          1,
                          1,
                          1,
                          1,
                          1,
                          1,
                          T.load("uint8", placeholder_global, 0),
                          736,
                          12,
                          T.load("uint8", placeholder_d_global, 0),
                          240,
                          0,
                          0,
                          0,
                          0,
                          "NONE",
                          0,
                          0,
                          "TFL",
                          "NONE",
                          dtype="handle"))
        T.evaluate(
            T.call_extern("ethosu_binary_elementwise",
                          "int8",
                          56,
                          56,
                          24,
                          56,
                          0,
                          56,
                          T.load("int8", featuremap_buffer, 0),
                          0,
                          0,
                          0,
                          T.float32(1),
                          0,
                          "NHWC",
                          1344,
                          24,
                          1,
                          "int8",
                          56,
                          56,
                          24,
                          56,
                          0,
                          56,
                          T.load("int8", featuremap_buffer2, 0),
                          0,
                          0,
                          0,
                          T.float32(1),
                          0,
                          "NHWC",
                          1344,
                          24,
                          1,
                          "int8",
                          56,
                          56,
                          24,
                          56,
                          0,
                          56,
                          T.load("int8", output_buffer.data, 0),
                          0,
                          0,
                          0,
                          T.float32(1),
                          0,
                          "NHWC",
                          1344,
                          24,
                          1,
                          "ADD",
                          0,
                          "NONE",
                          0,
                          0,
                          "TFL",
                          dtype="handle"))
Beispiel #3
0
 def main(placeholder: T.Buffer[(1, 8, 12, 16), "int8"],
          placeholder_1: T.Buffer[(1, 8, 10, 16), "int8"],
          T_concat: T.Buffer[(1, 8, 32, 16), "int8"]) -> None:
     # function attr dict
     T.func_attr({
         "from_legacy_te_schedule": True,
         "global_symbol": "main",
         "tir.noalias": True
     })
     buffer = T.buffer_var("uint8", "")
     buffer_1 = T.buffer_var("uint8", "")
     buffer_2 = T.buffer_var("uint8", "")
     buffer_3 = T.buffer_var("uint8", "")
     buffer_4 = T.buffer_var("uint8", "")
     buffer_5 = T.buffer_var("uint8", "")
     buffer_6 = T.buffer_var("uint8", "")
     buffer_7 = T.buffer_var("uint8", "")
     # 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,
                       T.load("int8", placeholder_1.data, 0),
                       0,
                       0,
                       0,
                       T.float32(0.5),
                       10,
                       "NHWC",
                       160,
                       16,
                       1,
                       "int8",
                       8,
                       10,
                       16,
                       8,
                       0,
                       10,
                       T.load("int8", T_concat_1, 192),
                       0,
                       0,
                       0,
                       T.float32(0.25),
                       14,
                       "NHWC",
                       352,
                       16,
                       1,
                       3,
                       3,
                       1,
                       1,
                       1,
                       1,
                       T.load("uint8", buffer, 0),
                       2992,
                       12,
                       T.load("uint8", buffer_1, 0),
                       160,
                       1,
                       1,
                       1,
                       1,
                       "NONE",
                       0,
                       0,
                       "TFL",
                       "NONE",
                       dtype="handle"))
     T.evaluate(
         T.call_extern("ethosu_conv2d",
                       "int8",
                       8,
                       10,
                       16,
                       8,
                       0,
                       10,
                       T.load("int8", T_concat_1, 192),
                       0,
                       0,
                       0,
                       T.float32(0.5),
                       10,
                       "NHWC",
                       352,
                       16,
                       1,
                       "int8",
                       8,
                       10,
                       16,
                       8,
                       0,
                       10,
                       T.load("int8", T_concat.data, 352),
                       0,
                       0,
                       0,
                       T.float32(0.25),
                       14,
                       "NHWC",
                       512,
                       16,
                       1,
                       3,
                       3,
                       1,
                       1,
                       1,
                       1,
                       T.load("uint8", buffer_2, 0),
                       2992,
                       12,
                       T.load("uint8", buffer_3, 0),
                       160,
                       1,
                       1,
                       1,
                       1,
                       "NONE",
                       0,
                       0,
                       "TFL",
                       "NONE",
                       dtype="handle"))
     T.evaluate(
         T.call_extern("ethosu_conv2d",
                       "int8",
                       8,
                       12,
                       16,
                       8,
                       0,
                       12,
                       T.load("int8", placeholder.data, 0),
                       0,
                       0,
                       0,
                       T.float32(0.5),
                       10,
                       "NHWC",
                       192,
                       16,
                       1,
                       "int8",
                       8,
                       12,
                       16,
                       8,
                       0,
                       12,
                       T.load("int8", T_concat_1, 0),
                       0,
                       0,
                       0,
                       T.float32(0.25),
                       14,
                       "NHWC",
                       352,
                       16,
                       1,
                       3,
                       3,
                       1,
                       1,
                       1,
                       1,
                       T.load("uint8", buffer_4, 0),
                       2992,
                       12,
                       T.load("uint8", buffer_5, 0),
                       160,
                       1,
                       1,
                       1,
                       1,
                       "NONE",
                       0,
                       0,
                       "TFL",
                       "NONE",
                       dtype="handle"))
     T.evaluate(
         T.call_extern("ethosu_conv2d",
                       "int8",
                       8,
                       22,
                       16,
                       8,
                       0,
                       22,
                       T.load("int8", T_concat_1, 0),
                       0,
                       0,
                       0,
                       T.float32(0.5),
                       10,
                       "NHWC",
                       352,
                       16,
                       1,
                       "int8",
                       8,
                       22,
                       16,
                       8,
                       0,
                       22,
                       T.load("int8", T_concat.data, 0),
                       0,
                       0,
                       0,
                       T.float32(0.25),
                       14,
                       "NHWC",
                       512,
                       16,
                       1,
                       3,
                       3,
                       1,
                       1,
                       1,
                       1,
                       T.load("uint8", buffer_6, 0),
                       2992,
                       12,
                       T.load("uint8", buffer_7, 0),
                       160,
                       1,
                       1,
                       1,
                       1,
                       "NONE",
                       0,
                       0,
                       "TFL",
                       "NONE",
                       dtype="handle"))