Home
last modified time | relevance | path

Searched refs:tensor_index (Results 1 – 25 of 83) sorted by relevance

1234

/external/tensorflow/tensorflow/lite/
Darena_planner.cc116 for (int tensor_index : graph_info_->outputs()) { in PlanAllocations() local
117 refcounts[tensor_index]++; in PlanAllocations()
122 for (int tensor_index : graph_info_->variables()) { in PlanAllocations() local
125 refcounts[tensor_index]++; in PlanAllocations()
128 TF_LITE_ENSURE(context_, tensor_index != kTfLiteOptionalTensor); in PlanAllocations()
130 TF_LITE_ENSURE_STATUS(allocate(0, tensor_index)); in PlanAllocations()
135 for (int tensor_index : graph_info_->inputs()) { in PlanAllocations() local
136 if (tensor_index != kTfLiteOptionalTensor) { in PlanAllocations()
137 refcounts[tensor_index]++; in PlanAllocations()
138 TF_LITE_ENSURE_STATUS(allocate(0, tensor_index)); in PlanAllocations()
[all …]
Dsimple_planner.cc102 for (int tensor_index : graph_info_->outputs()) { in PlanAllocations() local
103 refcounts[tensor_index]++; in PlanAllocations()
108 for (int tensor_index : graph_info_->variables()) { in PlanAllocations() local
111 refcounts[tensor_index]++; in PlanAllocations()
114 TF_LITE_ENSURE(context_, tensor_index != kTfLiteOptionalTensor); in PlanAllocations()
116 TF_LITE_ENSURE_STATUS(allocate(0, tensor_index)); in PlanAllocations()
121 for (int tensor_index : graph_info_->inputs()) { in PlanAllocations() local
122 if (tensor_index != kTfLiteOptionalTensor) { in PlanAllocations()
123 refcounts[tensor_index]++; in PlanAllocations()
124 TF_LITE_ENSURE_STATUS(allocate(0, tensor_index)); in PlanAllocations()
[all …]
Dinterpreter.h157 int tensor_index, TfLiteType type, const char* name,
163 int tensor_index, TfLiteType type, const char* name,
167 return SetTensorParametersReadOnly(tensor_index, type, name, dims.size(),
173 int tensor_index, TfLiteType type, const char* name, const size_t rank,
181 TfLiteStatus SetTensorParametersReadWrite(int tensor_index, TfLiteType type,
189 int tensor_index, TfLiteType type, const char* name,
200 tensor_index, type, name, dims.size(), dims.data(), quantization,
204 int tensor_index, TfLiteType type, const char* name, const size_t rank,
250 TfLiteTensor* tensor(int tensor_index) { in tensor() argument
251 return primary_subgraph().tensor(tensor_index); in tensor()
[all …]
Dinterpreter.cc209 TfLiteStatus Interpreter::ResizeInputTensor(int tensor_index, in ResizeInputTensor() argument
211 return primary_subgraph().ResizeInputTensor(tensor_index, dims); in ResizeInputTensor()
215 int tensor_index, const std::vector<int>& dims) { in ResizeInputTensorStrict() argument
216 return primary_subgraph().ResizeInputTensorStrict(tensor_index, dims); in ResizeInputTensorStrict()
232 for (int tensor_index : outputs()) { in Invoke() local
235 primary_subgraph().EnsureTensorDataIsReadable(tensor_index)); in Invoke()
248 int tensor_index, TfLiteType type, const char* name, in SetTensorParametersReadOnly() argument
252 tensor_index, type, name, dims.size(), dims.data(), quantization, buffer, in SetTensorParametersReadOnly()
257 int tensor_index, TfLiteType type, const char* name, in SetTensorParametersReadWrite() argument
261 tensor_index, type, name, dims.size(), dims.data(), quantization, in SetTensorParametersReadWrite()
[all …]
Dinterpreter_experimental.cc40 int tensor_index, const TfLiteCustomAllocation& allocation, int64_t flags) { in SetCustomAllocationForTensor() argument
41 return primary_subgraph().SetCustomAllocationForTensor(tensor_index, in SetCustomAllocationForTensor()
104 TfLiteStatus Interpreter::SetBufferHandle(int tensor_index, in SetBufferHandle() argument
107 TF_LITE_ENSURE(context_, tensor_index < tensors_size()); in SetBufferHandle()
108 TfLiteTensor* tensor = primary_subgraph().tensor(tensor_index); in SetBufferHandle()
123 TfLiteStatus Interpreter::GetBufferHandle(int tensor_index, in GetBufferHandle() argument
126 TF_LITE_ENSURE(context_, tensor_index < tensors_size()); in GetBufferHandle()
127 TfLiteTensor* tensor = primary_subgraph().tensor(tensor_index); in GetBufferHandle()
Doptional_debug_tools.cc51 void Update(size_t tensor_index, const TfLiteTensor& tensor) { in Update() argument
56 max_tensor_id_ = tensor_index; in Update()
70 info.tensor_id = tensor_index; in Update()
154 void Update(size_t tensor_index, const TfLiteTensor& tensor) { in Update() argument
155 rw_info_.Update(tensor_index, tensor); in Update()
156 rw_persistent_info_.Update(tensor_index, tensor); in Update()
157 mmap_info_.Update(tensor_index, tensor); in Update()
364 for (size_t tensor_index = 0; tensor_index < subgraph.tensors_size(); in PrintInterpreterState() local
365 tensor_index++) { in PrintInterpreterState()
367 subgraph.tensor(static_cast<int>(tensor_index)); in PrintInterpreterState()
[all …]
/external/tensorflow/tensorflow/lite/delegates/flex/
Dbuffer_map.cc29 bool BufferMap::HasTensor(int tensor_index) const { in HasTensor()
30 return id_to_tensor_.count(tensor_index) != 0; in HasTensor()
33 bool BufferMap::IsTensorFlowTensor(int tensor_index) const { in IsTensorFlowTensor()
34 return HasTensor(tensor_index) && owned_by_tf_.count(tensor_index) > 0; in IsTensorFlowTensor()
37 tensorflow::Tensor BufferMap::GetTensor(int tensor_index) const { in GetTensor()
38 return id_to_tensor_.at(tensor_index); in GetTensor()
41 const tensorflow::Tensor* BufferMap::GetTensorPtr(int tensor_index) const { in GetTensorPtr()
42 auto& tensor = id_to_tensor_.at(tensor_index); in GetTensorPtr()
46 void BufferMap::SetFromTfLite(int tensor_index, const TfLiteTensor* tensor) { in SetFromTfLite() argument
48 SetTfTensorFromTfLite(tensor, &id_to_tensor_[tensor_index]).ok()); in SetFromTfLite()
[all …]
Dtest_util.h52 void SetTypedValues(int tensor_index, const std::vector<T>& values) { in SetTypedValues() argument
53 memcpy(interpreter_->typed_tensor<T>(tensor_index), values.data(), in SetTypedValues()
59 std::vector<T> GetTypedValues(int tensor_index) { in GetTypedValues() argument
60 const TfLiteTensor* t = interpreter_->tensor(tensor_index); in GetTypedValues()
61 const T* tdata = interpreter_->typed_tensor<T>(tensor_index); in GetTypedValues()
66 void SetValues(int tensor_index, const std::vector<float>& values) { in SetValues() argument
67 SetTypedValues<float>(tensor_index, values); in SetValues()
69 void SetStringValues(int tensor_index, const std::vector<string>& values);
72 std::vector<float> GetValues(int tensor_index) { in GetValues() argument
73 return GetTypedValues<float>(tensor_index); in GetValues()
[all …]
Dbuffer_map.h39 bool HasTensor(int tensor_index) const;
44 bool IsTensorFlowTensor(int tensor_index) const;
48 tensorflow::Tensor GetTensor(int tensor_index) const;
53 const tensorflow::Tensor* GetTensorPtr(int tensor_index) const;
58 void SetFromTensorFlow(int tensor_index, tensorflow::Tensor tensor);
62 void SetFromTfLite(int tensor_index, const TfLiteTensor* tensor);
Dtest_util.cc28 void FlexModelTest::SetStringValues(int tensor_index, in SetStringValues() argument
34 dynamic_buffer.WriteToTensor(interpreter_->tensor(tensor_index), in SetStringValues()
38 std::vector<string> FlexModelTest::GetStringValues(int tensor_index) const { in GetStringValues()
41 TfLiteTensor* tensor = interpreter_->tensor(tensor_index); in GetStringValues()
51 void FlexModelTest::SetShape(int tensor_index, const std::vector<int>& values) { in SetShape() argument
52 ASSERT_EQ(interpreter_->ResizeInputTensor(tensor_index, values), kTfLiteOk); in SetShape()
56 std::vector<int> FlexModelTest::GetShape(int tensor_index) { in GetShape() argument
58 auto* dims = interpreter_->tensor(tensor_index)->dims; in GetShape()
66 TfLiteType FlexModelTest::GetType(int tensor_index) { in GetType() argument
67 return interpreter_->tensor(tensor_index)->type; in GetType()
[all …]
Dkernel.cc393 for (auto tensor_index : TfLiteIntArrayView(params->output_tensors)) { in Init() local
394 op_data_->subgraph_outputs.push_back(tensor_index); in Init()
395 output_set.insert(tensor_index); in Init()
399 for (auto tensor_index : TfLiteIntArrayView(params->input_tensors)) { in Init() local
400 op_data_->subgraph_inputs.push_back(tensor_index); in Init()
463 for (auto tensor_index : op_data_->subgraph_inputs) { in Prepare() local
464 TfLiteTensor* tensor = &context->tensors[tensor_index]; in Prepare()
466 if (!tensor->data_is_stale || !buffer_map->HasTensor(tensor_index)) { in Prepare()
467 buffer_map->SetFromTfLite(tensor_index, tensor); in Prepare()
474 tensor_ref_count[tensor_index] += 2; in Prepare()
[all …]
/external/tensorflow/tensorflow/lite/kernels/
Dkernel_util.cc43 int tensor_index) { in GetTensorAtIndex() argument
45 return &context->tensors[tensor_index]; in GetTensorAtIndex()
47 return context->GetTensor(context, tensor_index); in GetTensorAtIndex()
55 int* tensor_index) { in ValidateTensorIndexingSafe() argument
69 *tensor_index = tensor_indices[index]; in ValidateTensorIndexingSafe()
78 const int tensor_index = tensor_indices[index]; in ValidateTensorIndexing() local
79 if (tensor_index != kTfLiteOptionalTensor) { in ValidateTensorIndexing()
80 return tensor_index; in ValidateTensorIndexing()
88 const int tensor_index = ValidateTensorIndexing( in GetMutableInput() local
90 if (tensor_index < 0) { in GetMutableInput()
[all …]
/external/tensorflow/tensorflow/lite/delegates/gpu/
Dgl_delegate.cc80 int tensor_index; member
122 absl::Status BindBufferToTensor(GLuint ssbo, int tensor_index) { in BindBufferToTensor() argument
126 tensor_index, GlBuffer(GL_SHADER_STORAGE_BUFFER, ssbo, bytes_size, in BindBufferToTensor()
148 auto find_value = [&](int tensor_index) -> Value* { in Prepare() argument
150 if (value->tensor.ref == tensor_index) return value; in Prepare()
172 const int tensor_index = delegate_params->input_tensors->data[i]; in Prepare() local
173 auto* tensor = context->tensors + tensor_index; in Prepare()
177 tflite_graph_io.insert(tensor_index); in Prepare()
178 const auto* input = find_value(tensor_index); in Prepare()
186 tensors_[input->id].tensor_index = tensor_index; in Prepare()
[all …]
Dmetal_delegate.mm203 absl::Status BindBufferToTensor(id<MTLBuffer> buffer, int tensor_index) {
206 if (quant_conversion_map_.find(tensor_index) != quant_conversion_map_.end()) {
207 tensor_index = quant_conversion_map_[tensor_index];
210 quant_conversion_map_.erase(tensor_index);
213 if (input.tensor_id == tensor_index) {
224 if (output.tensor_id == tensor_index) {
234 return absl::NotFoundError("Couldn't find tensor: " + std::to_string(tensor_index));
277 auto find_value = [&](int tensor_index) -> Value* {
279 if (value->tensor.ref == tensor_index) return value;
296 for (int tensor_index : TfLiteIntArrayView(delegate_params->input_tensors)) {
[all …]
/external/tensorflow/tensorflow/lite/tools/
Dvisualize.py305 for tensor_input_position, tensor_index in enumerate(op["inputs"]):
306 if tensor_index not in first:
307 first[tensor_index] = ((op_index - 0.5 + 1) * pixel_mult,
310 "source": TensorName(tensor_index),
313 for tensor_output_position, tensor_index in enumerate(op["outputs"]):
314 if tensor_index not in second:
315 second[tensor_index] = ((op_index + 0.5 + 1) * pixel_mult,
318 "target": TensorName(tensor_index),
329 for tensor_index, tensor in enumerate(g["tensors"]):
331 first[tensor_index] if tensor_index in first else
[all …]
/external/tensorflow/tensorflow/lite/core/
Dsubgraph.h106 int tensor_index, TfLiteType type, const char* name,
110 return SetTensorParametersReadOnly(tensor_index, type, name, dims.size(),
115 int tensor_index, TfLiteType type, const char* name, const size_t rank,
125 int tensor_index, TfLiteType type, const char* name,
129 return SetTensorParametersReadWrite(tensor_index, type, name, dims.size(),
134 tensor_index, type, name, dims.size(), dims.data(), quantization,
138 int tensor_index, TfLiteType type, const char* name, const size_t rank,
144 TfLiteTensor* tensor(int tensor_index) { in tensor() argument
145 if (tensor_index < 0 || in tensor()
146 static_cast<size_t>(tensor_index) >= context_.tensors_size) { in tensor()
[all …]
Dsubgraph.cc435 for (int tensor_index : node_subset.output_tensors) { in ReplaceNodeSubsetsWithDelegateKernels() local
436 TfLiteTensor* tensor = &tensors_[tensor_index]; in ReplaceNodeSubsetsWithDelegateKernels()
855 int tensor_index = tensor_indexes->data[i]; in AnyTensorOfTypeResource() local
856 if (tensor_index >= 0 && tensor_index < tensors.size() && in AnyTensorOfTypeResource()
857 tensors[tensor_index].type == kTfLiteResource) in AnyTensorOfTypeResource()
880 TfLiteStatus Subgraph::ResizeInputTensor(int tensor_index, in ResizeInputTensor() argument
890 tensor_index < context_.tensors_size && tensor_index >= 0); in ResizeInputTensor()
891 TfLiteTensor* tensor = &context_.tensors[tensor_index]; in ResizeInputTensor()
912 TfLiteStatus Subgraph::ResizeInputTensorStrict(int tensor_index, in ResizeInputTensorStrict() argument
915 tensor_index < context_.tensors_size && tensor_index >= 0); in ResizeInputTensorStrict()
[all …]
/external/tensorflow/tensorflow/lite/tools/serialization/
Dwriter_lib.cc170 for (auto tensor_index : in ExportTensors() local
172 tensor_is_temporary[tensor_index] = true; in ExportTensors()
177 for (int tensor_index = 0; tensor_index < subgraph_->tensors_size(); in ExportTensors() local
178 tensor_index++) { in ExportTensors()
180 if (!tensor_is_temporary[tensor_index] && in ExportTensors()
181 unused_tensors_.find(tensor_index) == unused_tensors_.end()) { in ExportTensors()
182 tensor_to_written_tensor_[tensor_index] = curr_output_index++; in ExportTensors()
186 for (int tensor_index = 0; tensor_index < subgraph_->tensors_size(); in ExportTensors() local
187 ++tensor_index) { in ExportTensors()
189 if (tensor_to_written_tensor_[tensor_index] == -1) continue; in ExportTensors()
[all …]
/external/tensorflow/tensorflow/lite/python/
Dinterpreter.py511 def _get_tensor_details(self, tensor_index): argument
534 tensor_index = int(tensor_index)
535 tensor_name = self._interpreter.TensorName(tensor_index)
536 tensor_size = self._interpreter.TensorSize(tensor_index)
537 tensor_size_signature = self._interpreter.TensorSizeSignature(tensor_index)
538 tensor_type = self._interpreter.TensorType(tensor_index)
539 tensor_quantization = self._interpreter.TensorQuantization(tensor_index)
541 tensor_index)
543 tensor_index)
550 'index': tensor_index,
[all …]
/external/tensorflow/tensorflow/lite/delegates/hexagon/
Dhexagon_delegate_kernel.cc98 const auto tensor_index = node->inputs->data[input_idx]; in Eval() local
99 if (tensor_index == kTfLiteOptionalTensor) { in Eval()
102 TfLiteTensor* tensor = &context->tensors[tensor_index]; in Eval()
124 for (auto tensor_index : TfLiteIntArrayView(node->outputs)) { in Eval() local
125 if (tensor_index == kTfLiteOptionalTensor) { in Eval()
128 TfLiteTensor* tensor = &context->tensors[tensor_index]; in Eval()
211 for (auto tensor_index : TfLiteIntArrayView(node->inputs)) { in Prepare() local
212 tensors.push_back(tensor_index); in Prepare()
214 for (auto tensor_index : TfLiteIntArrayView(node->outputs)) { in Prepare() local
215 tensors.push_back(tensor_index); in Prepare()
[all …]
/external/tensorflow/tensorflow/lite/delegates/gpu/cl/
Dgpu_api_delegate.cc196 for (auto tensor_index : input_refs) { in Prepare() local
198 input_indices_.push_back(tensor_index); in Prepare()
200 builder->SetInputObjectDef(object_index, GetObjectDef(tensor_index))); in Prepare()
203 for (auto tensor_index : output_refs) { in Prepare() local
205 output_indices_.push_back(tensor_index); in Prepare()
207 GetObjectDef(tensor_index))); in Prepare()
232 void BindGlBufferToTensor(GLuint buffer_id, int tensor_index, in BindGlBufferToTensor() argument
236 if (tensor_index >= tensors_.size()) { in BindGlBufferToTensor()
237 tensors_.resize(tensor_index + 1); in BindGlBufferToTensor()
248 tensors_[tensor_index] = std::make_pair(obj, def); in BindGlBufferToTensor()
[all …]
/external/tensorflow/tensorflow/lite/tools/optimize/calibration/
Dcalibration_reader.cc42 int subgraph_index, tensor_index; in AddCalibrationToModel() local
43 std::tie(subgraph_index, tensor_index) = tensorid_stat.first; in AddCalibrationToModel()
49 auto tensor = subgraph->tensors[tensor_index].get(); in AddCalibrationToModel()
64 subgraph->tensors[tensor_index]->quantization = std::move(quant_params); in AddCalibrationToModel()
/external/tensorflow/tensorflow/lite/delegates/coreml/
Dcoreml_delegate_kernel.mm175 for (int tensor_index : TfLiteIntArrayView(node->inputs)) {
176 if (builder_->IsTensorUsed(tensor_index)) {
177 input_tensor_ids_.push_back(tensor_index);
182 for (int tensor_index : input_tensor_ids_) {
183 TfLiteTensor* tensor = &context->tensors[tensor_index];
193 {std::vector<float>(input_size), builder_->GetTensorName(tensor_index), input_shape});
197 for (int tensor_index : TfLiteIntArrayView(node->outputs)) {
198 TfLiteTensor* tensor = &context->tensors[tensor_index];
201 outputs_.push_back({std::vector<float>(output_size), builder_->GetTensorName(tensor_index)});
/external/tensorflow/tensorflow/python/keras/engine/
Dnode.py108 layer=layer, node_index=node_index, tensor_index=i)
140 tensor_index = keras_history.tensor_index
141 yield layer, node_index, tensor_index, kt
176 return [kh.layer.name, new_node_index, kh.tensor_index]
205 data = [kh.layer.name, new_node_index, kh.tensor_index, kwargs]
Dfunctional.py182 layer, node_index, tensor_index = x._keras_history # pylint: disable=protected-access
184 self._output_coordinates.append((layer, node_index, tensor_index))
188 layer, node_index, tensor_index = x._keras_history # pylint: disable=protected-access
192 assert tensor_index == 0
194 self._input_coordinates.append((layer, node_index, tensor_index))
468 kh.tensor_index)
488 layer, node_index, tensor_index = self._output_coordinates[i]
489 shape_key = layer.name + '_%s_%s' % (node_index, tensor_index)
1166 tensor_index = t[2]
1181 return nest.flatten(node.outputs)[tensor_index]
[all …]

1234