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

Function FillTensorWithData

tensorflow/lite/testing/tf_driver.cc:39–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37
38template <typename T>
39int FillTensorWithData(tensorflow::Tensor* tensor,
40 const string& values_as_string) {
41 const auto& values = testing::Split<T>(values_as_string, ",");
42
43 if (values.size() == tensor->NumElements()) {
44 auto data = tensor->flat<T>();
45 for (int i = 0; i < values.size(); i++) {
46 data(i) = values[i];
47 }
48 }
49
50 return values.size();
51}
52
53// Assumes 'values_as_string' is a hex string that gets converted into a
54// TF Lite DynamicBuffer. Strings are then extracted and copied into the

Callers

nothing calls this directly

Calls 3

dataFunction · 0.50
sizeMethod · 0.45
NumElementsMethod · 0.45

Tested by

no test coverage detected