| 475 | } |
| 476 | |
| 477 | tensorflow::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 |
no test coverage detected