| 287 | } |
| 288 | |
| 289 | void ConvertComplex64TensorConst(const Model& model, const string& name, |
| 290 | GraphDef* tensorflow_graph) { |
| 291 | if (HasAlreadyExportedConst(name, *tensorflow_graph)) { |
| 292 | return; |
| 293 | } |
| 294 | CHECK(model.HasArray(name)); |
| 295 | const auto& array = model.GetArray(name); |
| 296 | tensorflow::NodeDef* const_op = tensorflow_graph->add_node(); |
| 297 | const_op->set_op("Const"); |
| 298 | const_op->set_name(name); |
| 299 | (*const_op->mutable_attr())["dtype"].set_type(DT_COMPLEX64); |
| 300 | auto* tensor = (*const_op->mutable_attr())["value"].mutable_tensor(); |
| 301 | tensor->set_dtype(DT_COMPLEX64); |
| 302 | const auto& data = array.GetBuffer<ArrayDataType::kComplex64>().data; |
| 303 | for (auto index : data) { |
| 304 | tensor->add_scomplex_val(std::real(index)); |
| 305 | tensor->add_scomplex_val(std::imag(index)); |
| 306 | } |
| 307 | const auto& array_shape = array.shape(); |
| 308 | auto* shape = tensor->mutable_tensor_shape(); |
| 309 | for (int i = 0; i < array_shape.dimensions_count(); i++) { |
| 310 | shape->add_dim()->set_size(array_shape.dims(i)); |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | void CreateMatrixShapeTensorConst(const string& name, int rows, int cols, |
| 315 | GraphDef* tensorflow_graph) { |
no test coverage detected