| 118 | } |
| 119 | |
| 120 | Status RegisterPrimaryOps(const GraphFloat32& graph, const Node* node, |
| 121 | const std::vector<ValueId>& inputs, |
| 122 | const std::vector<ValueId>& outputs, |
| 123 | const RuntimeOptions& options, |
| 124 | std::vector<ComputeTaskDescriptorPtr>* tasks) { |
| 125 | int node_id = static_cast<int>(node->id); |
| 126 | auto op_type = OperationTypeFromString(node->operation.type); |
| 127 | switch (op_type) { |
| 128 | case OperationType::ADD: |
| 129 | *tasks = Add(node_id, inputs, outputs[0], |
| 130 | absl::any_cast<AddAttributes>(node->operation.attributes), |
| 131 | options); |
| 132 | break; |
| 133 | case OperationType::CONCAT: { |
| 134 | std::vector<BHWC> input_shapes; |
| 135 | for (auto& input : graph.FindInputs(node->id)) { |
| 136 | input_shapes.push_back(input->tensor.shape); |
| 137 | } |
| 138 | *tasks = |
| 139 | Concat(node_id, inputs, outputs[0], |
| 140 | absl::any_cast<ConcatAttributes>(node->operation.attributes), |
| 141 | input_shapes); |
| 142 | break; |
| 143 | } |
| 144 | case OperationType::CONVOLUTION_2D: |
| 145 | *tasks = SelectConvolution( |
| 146 | graph, node_id, inputs[0], outputs[0], |
| 147 | absl::any_cast<Convolution2DAttributes>(node->operation.attributes), |
| 148 | options); |
| 149 | break; |
| 150 | case OperationType::CONVOLUTION_TRANSPOSED: |
| 151 | *tasks = |
| 152 | ConvolutionTransposed(node_id, inputs[0], outputs[0], |
| 153 | absl::any_cast<ConvolutionTransposedAttributes>( |
| 154 | node->operation.attributes), |
| 155 | options); |
| 156 | break; |
| 157 | case OperationType::DEPTHWISE_CONVOLUTION: |
| 158 | *tasks = |
| 159 | SelectDepthWiseConv(node_id, inputs[0], outputs[0], |
| 160 | absl::any_cast<DepthwiseConvolution2DAttributes>( |
| 161 | node->operation.attributes), |
| 162 | options); |
| 163 | break; |
| 164 | case OperationType::FULLY_CONNECTED: |
| 165 | *tasks = FullyConnected( |
| 166 | node_id, inputs[0], outputs[0], |
| 167 | absl::any_cast<FullyConnectedAttributes>(node->operation.attributes), |
| 168 | options); |
| 169 | break; |
| 170 | case OperationType::HARD_SWISH: |
| 171 | *tasks = HardSwish(node_id, inputs[0], outputs[0], options); |
| 172 | break; |
| 173 | case OperationType::MAX_UNPOOLING_2D: |
| 174 | *tasks = MaxUnpooling( |
| 175 | node_id, inputs[0], inputs[1], outputs[0], |
| 176 | absl::any_cast<MaxUnpooling2DAttributes>(node->operation.attributes)); |
| 177 | break; |
no test coverage detected