MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ConvertComplex64TensorConst

Function ConvertComplex64TensorConst

tensorflow/lite/toco/export_tensorflow.cc:289–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287}
288
289void 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
314void CreateMatrixShapeTensorConst(const string& name, int rows, int cols,
315 GraphDef* tensorflow_graph) {

Calls 11

HasAlreadyExportedConstFunction · 0.85
realFunction · 0.85
imagFunction · 0.85
HasArrayMethod · 0.80
set_opMethod · 0.80
dimensions_countMethod · 0.80
set_nameMethod · 0.45
set_dtypeMethod · 0.45
shapeMethod · 0.45
set_sizeMethod · 0.45
dimsMethod · 0.45

Tested by

no test coverage detected