Home | History | Annotate | Download | only in models
      1 // clang-format off
      2 // Generated file (from: depthwise_conv.mod.py). Do not edit
      3 void CreateModel(Model *model) {
      4   OperandType type0(Type::INT32, {});
      5   OperandType type1(Type::TENSOR_FLOAT32, {1, 8, 8, 3});
      6   OperandType type2(Type::TENSOR_FLOAT32, {1, 1, 1, 3});
      7   OperandType type3(Type::TENSOR_FLOAT32, {3});
      8   // Phase 1, operands
      9   auto op2 = model->addOperand(&type1);
     10   auto op0 = model->addOperand(&type2);
     11   auto op1 = model->addOperand(&type3);
     12   auto b4 = model->addOperand(&type0);
     13   auto b5 = model->addOperand(&type0);
     14   auto b6 = model->addOperand(&type0);
     15   auto b7 = model->addOperand(&type0);
     16   auto b8 = model->addOperand(&type0);
     17   auto op3 = model->addOperand(&type1);
     18   // Phase 2, operations
     19   static float op0_init[] = {-0.966213f, -0.467474f, -0.82203f};
     20   model->setOperandValue(op0, op0_init, sizeof(float) * 3);
     21   static float op1_init[] = {0.0f, 0.0f, 0.0f};
     22   model->setOperandValue(op1, op1_init, sizeof(float) * 3);
     23   static int32_t b4_init[] = {1};
     24   model->setOperandValue(b4, b4_init, sizeof(int32_t) * 1);
     25   static int32_t b5_init[] = {1};
     26   model->setOperandValue(b5, b5_init, sizeof(int32_t) * 1);
     27   static int32_t b6_init[] = {1};
     28   model->setOperandValue(b6, b6_init, sizeof(int32_t) * 1);
     29   static int32_t b7_init[] = {1};
     30   model->setOperandValue(b7, b7_init, sizeof(int32_t) * 1);
     31   static int32_t b8_init[] = {0};
     32   model->setOperandValue(b8, b8_init, sizeof(int32_t) * 1);
     33   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op2, op0, op1, b4, b5, b6, b7, b8}, {op3});
     34   // Phase 3, inputs and outputs
     35   model->identifyInputsAndOutputs(
     36     {op2},
     37     {op3});
     38   assert(model->isValid());
     39 }
     40 
     41 inline bool is_ignored(int i) {
     42   static std::set<int> ignore = {};
     43   return ignore.find(i) != ignore.end();
     44 }
     45 
     46 void CreateModel_dynamic_output_shape(Model *model) {
     47   OperandType type0(Type::INT32, {});
     48   OperandType type1(Type::TENSOR_FLOAT32, {1, 8, 8, 3});
     49   OperandType type2(Type::TENSOR_FLOAT32, {1, 1, 1, 3});
     50   OperandType type3(Type::TENSOR_FLOAT32, {3});
     51   OperandType type4(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
     52   // Phase 1, operands
     53   auto op2 = model->addOperand(&type1);
     54   auto op0 = model->addOperand(&type2);
     55   auto op1 = model->addOperand(&type3);
     56   auto b4 = model->addOperand(&type0);
     57   auto b5 = model->addOperand(&type0);
     58   auto b6 = model->addOperand(&type0);
     59   auto b7 = model->addOperand(&type0);
     60   auto b8 = model->addOperand(&type0);
     61   auto op3 = model->addOperand(&type4);
     62   // Phase 2, operations
     63   static float op0_init[] = {-0.966213f, -0.467474f, -0.82203f};
     64   model->setOperandValue(op0, op0_init, sizeof(float) * 3);
     65   static float op1_init[] = {0.0f, 0.0f, 0.0f};
     66   model->setOperandValue(op1, op1_init, sizeof(float) * 3);
     67   static int32_t b4_init[] = {1};
     68   model->setOperandValue(b4, b4_init, sizeof(int32_t) * 1);
     69   static int32_t b5_init[] = {1};
     70   model->setOperandValue(b5, b5_init, sizeof(int32_t) * 1);
     71   static int32_t b6_init[] = {1};
     72   model->setOperandValue(b6, b6_init, sizeof(int32_t) * 1);
     73   static int32_t b7_init[] = {1};
     74   model->setOperandValue(b7, b7_init, sizeof(int32_t) * 1);
     75   static int32_t b8_init[] = {0};
     76   model->setOperandValue(b8, b8_init, sizeof(int32_t) * 1);
     77   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op2, op0, op1, b4, b5, b6, b7, b8}, {op3});
     78   // Phase 3, inputs and outputs
     79   model->identifyInputsAndOutputs(
     80     {op2},
     81     {op3});
     82   assert(model->isValid());
     83 }
     84 
     85 inline bool is_ignored_dynamic_output_shape(int i) {
     86   static std::set<int> ignore = {};
     87   return ignore.find(i) != ignore.end();
     88 }
     89 
     90 void CreateModel_2(Model *model) {
     91   OperandType type0(Type::INT32, {});
     92   OperandType type1(Type::TENSOR_FLOAT32, {1, 8, 8, 3});
     93   OperandType type2(Type::TENSOR_FLOAT32, {1, 1, 1, 3});
     94   OperandType type3(Type::TENSOR_FLOAT32, {3});
     95   // Phase 1, operands
     96   auto op2 = model->addOperand(&type1);
     97   auto op0 = model->addOperand(&type2);
     98   auto op1 = model->addOperand(&type3);
     99   auto b4 = model->addOperand(&type0);
    100   auto b5 = model->addOperand(&type0);
    101   auto b6 = model->addOperand(&type0);
    102   auto b7 = model->addOperand(&type0);
    103   auto b8 = model->addOperand(&type0);
    104   auto op3 = model->addOperand(&type1);
    105   // Phase 2, operations
    106   static float op0_init[] = {-0.966213f, -0.467474f, -0.82203f};
    107   model->setOperandValue(op0, op0_init, sizeof(float) * 3);
    108   static float op1_init[] = {0.0f, 0.0f, 0.0f};
    109   model->setOperandValue(op1, op1_init, sizeof(float) * 3);
    110   static int32_t b4_init[] = {1};
    111   model->setOperandValue(b4, b4_init, sizeof(int32_t) * 1);
    112   static int32_t b5_init[] = {1};
    113   model->setOperandValue(b5, b5_init, sizeof(int32_t) * 1);
    114   static int32_t b6_init[] = {1};
    115   model->setOperandValue(b6, b6_init, sizeof(int32_t) * 1);
    116   static int32_t b7_init[] = {1};
    117   model->setOperandValue(b7, b7_init, sizeof(int32_t) * 1);
    118   static int32_t b8_init[] = {0};
    119   model->setOperandValue(b8, b8_init, sizeof(int32_t) * 1);
    120   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op2, op0, op1, b4, b5, b6, b7, b8}, {op3});
    121   // Phase 3, inputs and outputs
    122   model->identifyInputsAndOutputs(
    123     {op2},
    124     {op3});
    125   assert(model->isValid());
    126 }
    127 
    128 inline bool is_ignored_2(int i) {
    129   static std::set<int> ignore = {};
    130   return ignore.find(i) != ignore.end();
    131 }
    132 
    133 void CreateModel_dynamic_output_shape_2(Model *model) {
    134   OperandType type0(Type::INT32, {});
    135   OperandType type1(Type::TENSOR_FLOAT32, {1, 8, 8, 3});
    136   OperandType type2(Type::TENSOR_FLOAT32, {1, 1, 1, 3});
    137   OperandType type3(Type::TENSOR_FLOAT32, {3});
    138   OperandType type4(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
    139   // Phase 1, operands
    140   auto op2 = model->addOperand(&type1);
    141   auto op0 = model->addOperand(&type2);
    142   auto op1 = model->addOperand(&type3);
    143   auto b4 = model->addOperand(&type0);
    144   auto b5 = model->addOperand(&type0);
    145   auto b6 = model->addOperand(&type0);
    146   auto b7 = model->addOperand(&type0);
    147   auto b8 = model->addOperand(&type0);
    148   auto op3 = model->addOperand(&type4);
    149   // Phase 2, operations
    150   static float op0_init[] = {-0.966213f, -0.467474f, -0.82203f};
    151   model->setOperandValue(op0, op0_init, sizeof(float) * 3);
    152   static float op1_init[] = {0.0f, 0.0f, 0.0f};
    153   model->setOperandValue(op1, op1_init, sizeof(float) * 3);
    154   static int32_t b4_init[] = {1};
    155   model->setOperandValue(b4, b4_init, sizeof(int32_t) * 1);
    156   static int32_t b5_init[] = {1};
    157   model->setOperandValue(b5, b5_init, sizeof(int32_t) * 1);
    158   static int32_t b6_init[] = {1};
    159   model->setOperandValue(b6, b6_init, sizeof(int32_t) * 1);
    160   static int32_t b7_init[] = {1};
    161   model->setOperandValue(b7, b7_init, sizeof(int32_t) * 1);
    162   static int32_t b8_init[] = {0};
    163   model->setOperandValue(b8, b8_init, sizeof(int32_t) * 1);
    164   model->addOperation(ANEURALNETWORKS_DEPTHWISE_CONV_2D, {op2, op0, op1, b4, b5, b6, b7, b8}, {op3});
    165   // Phase 3, inputs and outputs
    166   model->identifyInputsAndOutputs(
    167     {op2},
    168     {op3});
    169   assert(model->isValid());
    170 }
    171 
    172 inline bool is_ignored_dynamic_output_shape_2(int i) {
    173   static std::set<int> ignore = {};
    174   return ignore.find(i) != ignore.end();
    175 }
    176 
    177