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

Function ImportStringArray

tensorflow/lite/toco/import_tensorflow.cc:477–501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

475}
476
477tensorflow::Status ImportStringArray(const TensorProto& input_tensor,
478 Array* output_array) {
479 CHECK_EQ(input_tensor.dtype(), DT_STRING);
480 const auto& input_shape = input_tensor.tensor_shape();
481 CHECK_LE(input_shape.dim_size(), 6);
482 int input_flat_size;
483 auto status = ImportShape(input_shape.dim(), &input_flat_size,
484 output_array->mutable_shape());
485 if (!status.ok()) return status;
486
487 if (input_flat_size != input_tensor.string_val_size()) {
488 return tensorflow::errors::InvalidArgument(
489 "Input_content string_val doesn't have the right dimensions "
490 "for this string tensor");
491 }
492
493 auto& output_string_data =
494 output_array->GetMutableBuffer<ArrayDataType::kString>().data;
495 output_string_data.resize(RequiredBufferSizeForShape(output_array->shape()));
496 CHECK_GE(output_string_data.size(), input_flat_size);
497 for (int i = 0; i < input_flat_size; ++i) {
498 output_string_data[i] = input_tensor.string_val(i);
499 }
500 return tensorflow::Status::OK();
501}
502
503// Count the number of inputs of a given node. If
504// `tf_import_flags.drop_control_dependency` is true, count the number of

Callers 1

ConvertConstOperatorFunction · 0.85

Calls 11

ImportShapeFunction · 0.85
InvalidArgumentFunction · 0.85
dtypeMethod · 0.45
dim_sizeMethod · 0.45
dimMethod · 0.45
mutable_shapeMethod · 0.45
okMethod · 0.45
resizeMethod · 0.45
shapeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected