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

Function ImportBoolArray

tensorflow/lite/toco/import_tensorflow.cc:450–475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

448}
449
450tensorflow::Status ImportBoolArray(const TensorProto& input_tensor,
451 Array* output_array) {
452 CHECK_EQ(input_tensor.dtype(), DT_BOOL);
453 const auto& input_shape = input_tensor.tensor_shape();
454 CHECK_LE(input_shape.dim_size(), 6);
455 int input_flat_size;
456 auto status = ImportShape(input_shape.dim(), &input_flat_size,
457 output_array->mutable_shape());
458 if (!status.ok()) return status;
459
460 auto& output_bool_data =
461 output_array->GetMutableBuffer<ArrayDataType::kBool>().data;
462 output_bool_data.resize(RequiredBufferSizeForShape(output_array->shape()),
463 false);
464 status =
465 ImportTensorData<bool>(input_tensor, input_flat_size, &output_bool_data);
466 if (!status.ok() && output_bool_data.size() == 1) {
467 // Some graphs have bool const nodes without actual value...
468 // assuming that 'false' is implied.
469 // So far only encountered that in an array with 1 entry, let's
470 // require that until we encounter a graph where that's not the case.
471 output_bool_data[0] = false;
472 return tensorflow::Status::OK();
473 }
474 return status;
475}
476
477tensorflow::Status ImportStringArray(const TensorProto& input_tensor,
478 Array* output_array) {

Callers 1

ConvertConstOperatorFunction · 0.85

Calls 10

ImportShapeFunction · 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