| 2096 | } |
| 2097 | |
| 2098 | void ConvertOperator(const Model& model, const Operator& src_op, |
| 2099 | GraphDef* tensorflow_graph) { |
| 2100 | if (src_op.fused_activation_function != FusedActivationFunctionType::kNone) { |
| 2101 | LOG(FATAL) |
| 2102 | << "Unsupported: the input model has a fused activation function"; |
| 2103 | } |
| 2104 | |
| 2105 | if (src_op.type == OperatorType::kConv) { |
| 2106 | ConvertConvOperator(model, static_cast<const ConvOperator&>(src_op), |
| 2107 | tensorflow_graph); |
| 2108 | } else if (src_op.type == OperatorType::kDepthwiseConv) { |
| 2109 | ConvertDepthwiseConvOperator( |
| 2110 | model, static_cast<const DepthwiseConvOperator&>(src_op), |
| 2111 | tensorflow_graph); |
| 2112 | } else if (src_op.type == OperatorType::kDepthToSpace) { |
| 2113 | ConvertDepthToSpaceOperator( |
| 2114 | model, static_cast<const DepthToSpaceOperator&>(src_op), |
| 2115 | tensorflow_graph); |
| 2116 | } else if (src_op.type == OperatorType::kSpaceToDepth) { |
| 2117 | ConvertSpaceToDepthOperator( |
| 2118 | model, static_cast<const SpaceToDepthOperator&>(src_op), |
| 2119 | tensorflow_graph); |
| 2120 | } else if (src_op.type == OperatorType::kFullyConnected) { |
| 2121 | ConvertFullyConnectedOperator( |
| 2122 | model, static_cast<const FullyConnectedOperator&>(src_op), |
| 2123 | tensorflow_graph); |
| 2124 | } else if (src_op.type == OperatorType::kAdd) { |
| 2125 | ConvertAddOperator(model, static_cast<const AddOperator&>(src_op), |
| 2126 | tensorflow_graph); |
| 2127 | } else if (src_op.type == OperatorType::kAddN) { |
| 2128 | ConvertAddNOperator(model, static_cast<const AddNOperator&>(src_op), |
| 2129 | tensorflow_graph); |
| 2130 | } else if (src_op.type == OperatorType::kMul) { |
| 2131 | ConvertMulOperator(model, static_cast<const MulOperator&>(src_op), |
| 2132 | tensorflow_graph); |
| 2133 | } else if (src_op.type == OperatorType::kDiv) { |
| 2134 | ConvertDivOperator(model, static_cast<const DivOperator&>(src_op), |
| 2135 | tensorflow_graph); |
| 2136 | } else if (src_op.type == OperatorType::kRelu) { |
| 2137 | ConvertReluOperator(model, static_cast<const ReluOperator&>(src_op), |
| 2138 | tensorflow_graph); |
| 2139 | } else if (src_op.type == OperatorType::kRelu1) { |
| 2140 | ConvertRelu1Operator(static_cast<const Relu1Operator&>(src_op), |
| 2141 | tensorflow_graph); |
| 2142 | } else if (src_op.type == OperatorType::kRelu6) { |
| 2143 | ConvertRelu6Operator(static_cast<const Relu6Operator&>(src_op), |
| 2144 | tensorflow_graph); |
| 2145 | } else if (src_op.type == OperatorType::kLog) { |
| 2146 | ConvertLogOperator(static_cast<const LogOperator&>(src_op), |
| 2147 | tensorflow_graph); |
| 2148 | } else if (src_op.type == OperatorType::kLogistic) { |
| 2149 | ConvertLogisticOperator(static_cast<const LogisticOperator&>(src_op), |
| 2150 | tensorflow_graph); |
| 2151 | } else if (src_op.type == OperatorType::kTanh) { |
| 2152 | ConvertTanhOperator(static_cast<const TanhOperator&>(src_op), |
| 2153 | tensorflow_graph); |
| 2154 | } else if (src_op.type == OperatorType::kL2Normalization) { |
| 2155 | ConvertL2NormalizationOperator( |
no test coverage detected