| 1221 | } |
| 1222 | |
| 1223 | void ConvertGatherOperator(const Model& model, const GatherOperator& src_op, |
| 1224 | GraphDef* tensorflow_graph) { |
| 1225 | tensorflow::NodeDef* gather_op = tensorflow_graph->add_node(); |
| 1226 | gather_op->set_op("GatherV2"); |
| 1227 | gather_op->set_name(src_op.outputs[0]); |
| 1228 | *gather_op->add_input() = src_op.inputs[0]; |
| 1229 | *gather_op->add_input() = src_op.inputs[1]; |
| 1230 | |
| 1231 | if (!src_op.axis) { |
| 1232 | // Dynamic axis. |
| 1233 | CHECK_EQ(src_op.inputs.size(), 3); |
| 1234 | *gather_op->add_input() = src_op.inputs[2]; |
| 1235 | } else { |
| 1236 | // Constant axis. |
| 1237 | CHECK_EQ(src_op.inputs.size(), 2); |
| 1238 | const string gather_axis = |
| 1239 | AvailableArrayName(model, gather_op->name() + "/axis"); |
| 1240 | CreateIntTensorConst(gather_axis, {src_op.axis.value()}, {}, |
| 1241 | tensorflow_graph); |
| 1242 | *gather_op->add_input() = gather_axis; |
| 1243 | } |
| 1244 | |
| 1245 | (*gather_op->mutable_attr())["Tindices"].set_type(DT_INT32); |
| 1246 | (*gather_op->mutable_attr())["Taxis"].set_type(DT_INT32); |
| 1247 | const tensorflow::DataType params_type = |
| 1248 | GetTensorFlowDataType(model, src_op.inputs[0]); |
| 1249 | (*gather_op->mutable_attr())["Tparams"].set_type(params_type); |
| 1250 | } |
| 1251 | |
| 1252 | void ConvertArgMaxOperator(const Model& model, const ArgMaxOperator& src_op, |
| 1253 | GraphDef* tensorflow_graph) { |
no test coverage detected