/aosp_15_r20/external/tensorflow/tensorflow/lite/ |
H A D | arena_planner.cc | 120 for (int tensor_index : graph_info_->outputs()) { in PlanAllocations() local 121 refcounts[tensor_index]++; in PlanAllocations() 126 for (int tensor_index : graph_info_->variables()) { in PlanAllocations() local 129 refcounts[tensor_index]++; in PlanAllocations() 132 TF_LITE_ENSURE(context_, tensor_index != kTfLiteOptionalTensor); in PlanAllocations() 134 TF_LITE_ENSURE_STATUS(allocate(0, tensor_index)); in PlanAllocations() 139 for (int tensor_index : graph_info_->inputs()) { in PlanAllocations() local 140 if (tensor_index != kTfLiteOptionalTensor) { in PlanAllocations() 141 refcounts[tensor_index]++; in PlanAllocations() 142 TF_LITE_ENSURE_STATUS(allocate(0, tensor_index)); in PlanAllocations() [all …]
|
H A D | simple_planner.cc | 102 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 …]
|
H A D | interpreter.h | 158 int tensor_index, TfLiteType type, const char* name, 164 int tensor_index, TfLiteType type, const char* name, 168 return SetTensorParametersReadOnly(tensor_index, type, name, dims.size(), 174 int tensor_index, TfLiteType type, const char* name, const size_t rank, 182 TfLiteStatus SetTensorParametersReadWrite(int tensor_index, TfLiteType type, 190 int tensor_index, TfLiteType type, const char* name, 201 tensor_index, type, name, dims.size(), dims.data(), quantization, 205 int tensor_index, TfLiteType type, const char* name, const size_t rank, 251 TfLiteTensor* tensor(int tensor_index) { in tensor() argument 252 return primary_subgraph().tensor(tensor_index); in tensor() [all …]
|
H A D | optional_debug_tools.cc | 55 void Update(size_t tensor_index, const TfLiteTensor& tensor) { in Update() argument 60 max_tensor_id_ = tensor_index; in Update() 74 info.tensor_id = tensor_index; in Update() 153 void Update(size_t tensor_index, const TfLiteTensor& tensor) { in Update() argument 159 max_tensor_ids_.push_back(tensor_index); in Update() 161 max_tensor_ids_.push_back(static_cast<int>(tensor_index)); in Update() 197 void Update(size_t tensor_index, const TfLiteTensor& tensor) { in Update() argument 198 rw_info_.Update(tensor_index, tensor); in Update() 199 rw_persistent_info_.Update(tensor_index, tensor); in Update() 200 mmap_info_.Update(tensor_index, tensor); in Update() [all …]
|
H A D | interpreter.cc | 211 TfLiteStatus Interpreter::ResizeInputTensor(int tensor_index, in ResizeInputTensor() argument 213 return primary_subgraph().ResizeInputTensor(tensor_index, dims); in ResizeInputTensor() 217 int tensor_index, const std::vector<int>& dims) { in ResizeInputTensorStrict() argument 218 return primary_subgraph().ResizeInputTensorStrict(tensor_index, dims); in ResizeInputTensorStrict() 234 for (int tensor_index : outputs()) { in Invoke() local 237 primary_subgraph().EnsureTensorDataIsReadable(tensor_index)); in Invoke() 250 int tensor_index, TfLiteType type, const char* name, in SetTensorParametersReadOnly() argument 254 tensor_index, type, name, dims.size(), dims.data(), quantization, buffer, in SetTensorParametersReadOnly() 259 int tensor_index, TfLiteType type, const char* name, in SetTensorParametersReadWrite() argument 263 tensor_index, type, name, dims.size(), dims.data(), quantization, in SetTensorParametersReadWrite() [all …]
|
H A D | interpreter_experimental.cc | 39 int tensor_index, const TfLiteCustomAllocation& allocation, int64_t flags) { in SetCustomAllocationForTensor() argument 40 return primary_subgraph().SetCustomAllocationForTensor(tensor_index, in SetCustomAllocationForTensor() 81 TfLiteStatus Interpreter::SetBufferHandle(int tensor_index, in SetBufferHandle() argument 84 TF_LITE_ENSURE(context_, tensor_index < tensors_size()); in SetBufferHandle() 85 TfLiteTensor* tensor = primary_subgraph().tensor(tensor_index); in SetBufferHandle() 100 TfLiteStatus Interpreter::GetBufferHandle(int tensor_index, in GetBufferHandle() argument 103 TF_LITE_ENSURE(context_, tensor_index < tensors_size()); in GetBufferHandle() 104 TfLiteTensor* tensor = primary_subgraph().tensor(tensor_index); in GetBufferHandle()
|
/aosp_15_r20/external/tensorflow/tensorflow/lite/delegates/flex/ |
H A D | buffer_map.cc | 32 bool BufferMap::HasTensor(int tensor_index) const { in HasTensor() 33 return id_to_tensor_.count(tensor_index) != 0; in HasTensor() 36 bool BufferMap::IsTensorFlowTensor(int tensor_index) const { in IsTensorFlowTensor() 37 return HasTensor(tensor_index) && owned_by_tf_.count(tensor_index) > 0; in IsTensorFlowTensor() 40 tensorflow::Tensor BufferMap::GetTensor(int tensor_index) const { in GetTensor() 41 return id_to_tensor_.at(tensor_index); in GetTensor() 44 const tensorflow::Tensor* BufferMap::GetTensorPtr(int tensor_index) const { in GetTensorPtr() 45 auto& tensor = id_to_tensor_.at(tensor_index); in GetTensorPtr() 49 void BufferMap::SetFromTfLite(int tensor_index, const TfLiteTensor* tensor, in SetFromTfLite() argument 52 SetTfTensorFromTfLite(tensor, &id_to_tensor_[tensor_index], allow_reusing) in SetFromTfLite() [all …]
|
H A D | kernel.cc | 300 int tensor_index, int node_index) { in ShouldPersistTensorflowTensor() argument 301 TfLiteTensor* tensor = &context->tensors[tensor_index]; in ShouldPersistTensorflowTensor() 308 auto it = shared_info->tensor_release_map->find(tensor_index); in ShouldPersistTensorflowTensor() 319 int tensor_index) const { in CopyToTfLiteTensor() 331 tensor->name, tensor_index, tf_tensor->TotalBytes(), in CopyToTfLiteTensor() 339 shared_info->already_transferred_outputs.insert(tensor_index); in CopyToTfLiteTensor() 455 for (auto tensor_index : TfLiteIntArrayView(params->output_tensors)) { in Init() local 456 op_data_->subgraph_outputs.push_back(tensor_index); in Init() 457 output_set.insert(tensor_index); in Init() 461 for (auto tensor_index : TfLiteIntArrayView(params->input_tensors)) { in Init() local [all …]
|
H A D | test_util.h | 52 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 …]
|
H A D | test_util.cc | 28 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 …]
|
H A D | buffer_map.h | 39 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); 64 void SetFromTfLite(int tensor_index, const TfLiteTensor* tensor,
|
/aosp_15_r20/external/tensorflow/tensorflow/lite/kernels/ |
H A D | kernel_util.cc | 44 int tensor_index) { in GetTensorAtIndex() argument 46 return &context->tensors[tensor_index]; in GetTensorAtIndex() 48 return context->GetTensor(context, tensor_index); in GetTensorAtIndex() 56 int* tensor_index) { in ValidateTensorIndexingSafe() argument 70 *tensor_index = tensor_indices[index]; in ValidateTensorIndexingSafe() 79 const int tensor_index = tensor_indices[index]; in ValidateTensorIndexing() local 80 if (tensor_index != kTfLiteOptionalTensor) { in ValidateTensorIndexing() 81 return tensor_index; in ValidateTensorIndexing() 89 const int tensor_index = ValidateTensorIndexing( in GetMutableInput() local 91 if (tensor_index < 0) { in GetMutableInput() [all …]
|
/aosp_15_r20/external/tensorflow/tensorflow/lite/delegates/gpu/ |
H A D | gl_delegate.cc | 80 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 …]
|
H A D | metal_delegate.mm | 204 absl::Status BindBufferToTensor(id<MTLBuffer> buffer, int tensor_index) { 207 if (quant_conversion_map_.find(tensor_index) != quant_conversion_map_.end()) { 208 tensor_index = quant_conversion_map_[tensor_index]; 211 quant_conversion_map_.erase(tensor_index); 214 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 …]
|
/aosp_15_r20/external/tensorflow/tensorflow/lite/python/ |
H A D | interpreter.py | 291 for input_name, tensor_index in self._inputs.items(): 292 …result[input_name] = self._interpreter._get_tensor_details(tensor_index) # pylint: disable=protec… 304 for output_name, tensor_index in self._outputs: 305 …result[output_name] = self._interpreter._get_tensor_details(tensor_index) # pylint: disable=prote… 568 def _get_tensor_details(self, tensor_index): argument 591 tensor_index = int(tensor_index) 592 tensor_name = self._interpreter.TensorName(tensor_index) 593 tensor_size = self._interpreter.TensorSize(tensor_index) 594 tensor_size_signature = self._interpreter.TensorSizeSignature(tensor_index) 595 tensor_type = self._interpreter.TensorType(tensor_index) [all …]
|
/aosp_15_r20/external/tensorflow/tensorflow/lite/core/ |
H A D | subgraph.h | 110 int tensor_index, TfLiteType type, const char* name, 114 return SetTensorParametersReadOnly(tensor_index, type, name, dims.size(), 119 int tensor_index, TfLiteType type, const char* name, const size_t ndims, 129 int tensor_index, TfLiteType type, const char* name, 133 return SetTensorParametersReadWrite(tensor_index, type, name, dims.size(), 138 tensor_index, type, name, dims.size(), dims.data(), quantization, 142 int tensor_index, TfLiteType type, const char* name, const size_t ndims, 148 TfLiteTensor* tensor(int tensor_index) { in tensor() argument 149 if (tensor_index < 0 || in tensor() 150 static_cast<size_t>(tensor_index) >= context_.tensors_size) { in tensor() [all …]
|
H A D | subgraph.cc | 453 for (int tensor_index : node_subset.output_tensors) { in ReplaceNodeSubsetsWithDelegateKernels() local 454 TfLiteTensor* tensor = &tensors_[tensor_index]; in ReplaceNodeSubsetsWithDelegateKernels() 867 int tensor_index = tensor_indexes->data[i]; in AnyTensorOfTypeResource() local 868 if (tensor_index >= 0 && tensor_index < tensors.size() && in AnyTensorOfTypeResource() 869 tensors[tensor_index].type == kTfLiteResource) in AnyTensorOfTypeResource() 892 TfLiteStatus Subgraph::ResizeInputTensor(int tensor_index, in ResizeInputTensor() argument 902 tensor_index < context_.tensors_size && tensor_index >= 0); in ResizeInputTensor() 903 TfLiteTensor* tensor = &context_.tensors[tensor_index]; in ResizeInputTensor() 924 TfLiteStatus Subgraph::ResizeInputTensorStrict(int tensor_index, in ResizeInputTensorStrict() argument 927 tensor_index < context_.tensors_size && tensor_index >= 0); in ResizeInputTensorStrict() [all …]
|
/aosp_15_r20/external/tensorflow/tensorflow/lite/tools/ |
H A D | visualize.py | 304 for tensor_input_position, tensor_index in enumerate(op["inputs"]): 305 if tensor_index not in first: 306 first[tensor_index] = ((op_index - 0.5 + 1) * pixel_mult, 309 "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 …]
|
/aosp_15_r20/external/tensorflow/tensorflow/lite/tools/serialization/ |
H A D | writer_lib.cc | 175 for (auto tensor_index : in ExportTensors() local 177 tensor_is_temporary[tensor_index] = true; in ExportTensors() 182 for (int tensor_index = 0; tensor_index < subgraph_->tensors_size(); in ExportTensors() local 183 tensor_index++) { in ExportTensors() 185 if (!tensor_is_temporary[tensor_index] && in ExportTensors() 186 unused_tensors_.find(tensor_index) == unused_tensors_.end()) { in ExportTensors() 187 tensor_to_written_tensor_[tensor_index] = curr_output_index++; in ExportTensors() 191 for (int tensor_index = 0; tensor_index < subgraph_->tensors_size(); in ExportTensors() local 192 ++tensor_index) { in ExportTensors() 194 if (tensor_to_written_tensor_[tensor_index] == -1) continue; in ExportTensors() [all …]
|
/aosp_15_r20/external/pytorch/aten/src/ATen/ |
H A D | TensorIndexing.cpp | 16 std::ostream& operator<<(std::ostream& stream, const TensorIndex& tensor_index) { in operator <<() argument 17 if (tensor_index.is_none()) { in operator <<() 19 } else if (tensor_index.is_ellipsis()) { in operator <<() 21 } else if (tensor_index.is_integer()) { in operator <<() 22 stream << tensor_index.integer(); in operator <<() 23 } else if (tensor_index.is_boolean()) { in operator <<() 24 stream << std::boolalpha << tensor_index.boolean(); in operator <<() 25 } else if (tensor_index.is_slice()) { in operator <<() 26 stream << tensor_index.slice(); in operator <<() 27 } else if (tensor_index.is_tensor()) { in operator <<() [all …]
|
/aosp_15_r20/external/tensorflow/tensorflow/lite/delegates/hexagon/ |
H A D | hexagon_delegate_kernel.cc | 100 const auto tensor_index = node->inputs->data[input_idx]; in Eval() local 101 if (tensor_index == kTfLiteOptionalTensor) { in Eval() 104 TfLiteTensor* tensor = &context->tensors[tensor_index]; in Eval() 126 for (auto tensor_index : TfLiteIntArrayView(node->outputs)) { in Eval() local 127 if (tensor_index == kTfLiteOptionalTensor) { in Eval() 130 TfLiteTensor* tensor = &context->tensors[tensor_index]; in Eval() 215 for (auto tensor_index : TfLiteIntArrayView(node->inputs)) { in Prepare() local 216 tensors.push_back(tensor_index); in Prepare() 218 for (auto tensor_index : TfLiteIntArrayView(node->outputs)) { in Prepare() local 219 tensors.push_back(tensor_index); in Prepare() [all …]
|
/aosp_15_r20/external/tensorflow/tensorflow/lite/delegates/gpu/cl/ |
H A D | gpu_api_delegate.cc | 196 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 …]
|
/aosp_15_r20/external/pytorch/aten/src/ATen/native/mps/operations/ |
H A D | MultiTensorApply.h | 262 for (const auto tensor_index : c10::irange(num_tensors)) { 264 if (tensor_lists[0][tensor_index].numel() == 0) { 269 … mtl_setBuffer(tensorArgumentEncoder, tensor_lists[d][tensor_index], d * kmaxTensors + tensor_loc); 270 …[computeEncoder useResource:getMTLBufferStorage(tensor_lists[d][tensor_index]) usage:MTLResourceUs… 273 … mtl_setBuffer(tensorArgumentEncoder, state_steps[tensor_index], depth * kmaxTensors + tensor_loc); 274 …[computeEncoder useResource:getMTLBufferStorage(state_steps[tensor_index]) usage:MTLResourceUsageR… 276 metadata_arguments.numels[tensor_loc] = tensor_lists[0][tensor_index].numel(); 280 const auto numel = tensor_lists[0][tensor_index].numel(); 316 … mtl_setBuffer(tensorArgumentEncoder, tensor_lists[d][tensor_index], d * kmaxTensors); 317 …[computeEncoder useResource:getMTLBufferStorage(tensor_lists[d][tensor_index]) usage:MTLResourceUs… [all …]
|
/aosp_15_r20/external/tensorflow/tensorflow/python/keras/engine/ |
H A D | functional.py | 182 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 …]
|
/aosp_15_r20/external/tensorflow/tensorflow/lite/delegates/coreml/ |
H A D | coreml_delegate_kernel.mm | 175 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)});
|