Home | History | Annotate | Download | only in models
      1 // clang-format off
      2 // Generated file (from: split_int32_4.mod.py). Do not edit
      3 void CreateModel(Model *model) {
      4   OperandType type0(Type::TENSOR_INT32, {2, 2, 2});
      5   OperandType type1(Type::INT32, {});
      6   OperandType type2(Type::TENSOR_INT32, {2, 1, 2});
      7   // Phase 1, operands
      8   auto input0 = model->addOperand(&type0);
      9   auto axis = model->addOperand(&type1);
     10   auto num_splits = model->addOperand(&type1);
     11   auto output0 = model->addOperand(&type2);
     12   auto output1 = model->addOperand(&type2);
     13   // Phase 2, operations
     14   static int32_t axis_init[] = {1};
     15   model->setOperandValue(axis, axis_init, sizeof(int32_t) * 1);
     16   static int32_t num_splits_init[] = {2};
     17   model->setOperandValue(num_splits, num_splits_init, sizeof(int32_t) * 1);
     18   model->addOperation(ANEURALNETWORKS_SPLIT, {input0, axis, num_splits}, {output0, output1});
     19   // Phase 3, inputs and outputs
     20   model->identifyInputsAndOutputs(
     21     {input0},
     22     {output0, output1});
     23   assert(model->isValid());
     24 }
     25 
     26 inline bool is_ignored(int i) {
     27   static std::set<int> ignore = {};
     28   return ignore.find(i) != ignore.end();
     29 }
     30 
     31 void CreateModel_relaxed(Model *model) {
     32   OperandType type0(Type::TENSOR_INT32, {2, 2, 2});
     33   OperandType type1(Type::INT32, {});
     34   OperandType type2(Type::TENSOR_INT32, {2, 1, 2});
     35   // Phase 1, operands
     36   auto input0 = model->addOperand(&type0);
     37   auto axis = model->addOperand(&type1);
     38   auto num_splits = model->addOperand(&type1);
     39   auto output0 = model->addOperand(&type2);
     40   auto output1 = model->addOperand(&type2);
     41   // Phase 2, operations
     42   static int32_t axis_init[] = {1};
     43   model->setOperandValue(axis, axis_init, sizeof(int32_t) * 1);
     44   static int32_t num_splits_init[] = {2};
     45   model->setOperandValue(num_splits, num_splits_init, sizeof(int32_t) * 1);
     46   model->addOperation(ANEURALNETWORKS_SPLIT, {input0, axis, num_splits}, {output0, output1});
     47   // Phase 3, inputs and outputs
     48   model->identifyInputsAndOutputs(
     49     {input0},
     50     {output0, output1});
     51   // Phase 4: set relaxed execution
     52   model->relaxComputationFloat32toFloat16(true);
     53   assert(model->isValid());
     54 }
     55 
     56 inline bool is_ignored_relaxed(int i) {
     57   static std::set<int> ignore = {};
     58   return ignore.find(i) != ignore.end();
     59 }
     60 
     61 void CreateModel_dynamic_output_shape(Model *model) {
     62   OperandType type0(Type::TENSOR_INT32, {2, 2, 2});
     63   OperandType type1(Type::INT32, {});
     64   OperandType type3(Type::TENSOR_INT32, {0, 0, 0});
     65   // Phase 1, operands
     66   auto input0 = model->addOperand(&type0);
     67   auto axis = model->addOperand(&type1);
     68   auto num_splits = model->addOperand(&type1);
     69   auto output0 = model->addOperand(&type3);
     70   auto output1 = model->addOperand(&type3);
     71   // Phase 2, operations
     72   static int32_t axis_init[] = {1};
     73   model->setOperandValue(axis, axis_init, sizeof(int32_t) * 1);
     74   static int32_t num_splits_init[] = {2};
     75   model->setOperandValue(num_splits, num_splits_init, sizeof(int32_t) * 1);
     76   model->addOperation(ANEURALNETWORKS_SPLIT, {input0, axis, num_splits}, {output0, output1});
     77   // Phase 3, inputs and outputs
     78   model->identifyInputsAndOutputs(
     79     {input0},
     80     {output0, output1});
     81   assert(model->isValid());
     82 }
     83 
     84 inline bool is_ignored_dynamic_output_shape(int i) {
     85   static std::set<int> ignore = {};
     86   return ignore.find(i) != ignore.end();
     87 }
     88 
     89 void CreateModel_dynamic_output_shape_relaxed(Model *model) {
     90   OperandType type0(Type::TENSOR_INT32, {2, 2, 2});
     91   OperandType type1(Type::INT32, {});
     92   OperandType type3(Type::TENSOR_INT32, {0, 0, 0});
     93   // Phase 1, operands
     94   auto input0 = model->addOperand(&type0);
     95   auto axis = model->addOperand(&type1);
     96   auto num_splits = model->addOperand(&type1);
     97   auto output0 = model->addOperand(&type3);
     98   auto output1 = model->addOperand(&type3);
     99   // Phase 2, operations
    100   static int32_t axis_init[] = {1};
    101   model->setOperandValue(axis, axis_init, sizeof(int32_t) * 1);
    102   static int32_t num_splits_init[] = {2};
    103   model->setOperandValue(num_splits, num_splits_init, sizeof(int32_t) * 1);
    104   model->addOperation(ANEURALNETWORKS_SPLIT, {input0, axis, num_splits}, {output0, output1});
    105   // Phase 3, inputs and outputs
    106   model->identifyInputsAndOutputs(
    107     {input0},
    108     {output0, output1});
    109   // Phase 4: set relaxed execution
    110   model->relaxComputationFloat32toFloat16(true);
    111   assert(model->isValid());
    112 }
    113 
    114 inline bool is_ignored_dynamic_output_shape_relaxed(int i) {
    115   static std::set<int> ignore = {};
    116   return ignore.find(i) != ignore.end();
    117 }
    118 
    119