/external/tensorflow/tensorflow/lite/toco/graph_transformations/ |
D | quantization_util.cc | 26 const FakeQuantOperator& op, ArrayDataType* out_quantized_data_type) { in InferQuantizedDataTypeFromFakeQuant() 28 *out_quantized_data_type = ArrayDataType::kUint8; in InferQuantizedDataTypeFromFakeQuant() 31 *out_quantized_data_type = ArrayDataType::kInt16; in InferQuantizedDataTypeFromFakeQuant() 34 *out_quantized_data_type = ArrayDataType::kNone; in InferQuantizedDataTypeFromFakeQuant() 39 bool GetQuantizedDataTypeNumericalRange(ArrayDataType data_type, in GetQuantizedDataTypeNumericalRange() 43 case ArrayDataType::kUint8: in GetQuantizedDataTypeNumericalRange() 47 case ArrayDataType::kInt16: in GetQuantizedDataTypeNumericalRange() 56 ArrayDataType GetQuantizedDataType(const Array& array, in GetQuantizedDataType() 57 ArrayDataType default_type) { in GetQuantizedDataType() 59 case ArrayDataType::kInt8: in GetQuantizedDataType() [all …]
|
D | resolve_constant_reshape.cc | 46 if (output_array.data_type == ArrayDataType::kNone) { in Run() 65 case ArrayDataType::kBool: in Run() 66 CopyArrayBuffer<ArrayDataType::kBool>(input_array, &output_array); in Run() 68 case ArrayDataType::kFloat: in Run() 69 CopyArrayBuffer<ArrayDataType::kFloat>(input_array, &output_array); in Run() 71 case ArrayDataType::kInt8: in Run() 72 CopyArrayBuffer<ArrayDataType::kInt8>(input_array, &output_array); in Run() 74 case ArrayDataType::kUint8: in Run() 75 CopyArrayBuffer<ArrayDataType::kUint8>(input_array, &output_array); in Run() 77 case ArrayDataType::kInt16: in Run() [all …]
|
D | resolve_constant_fake_quant.cc | 28 template <ArrayDataType A> 35 void GetBoundsForQuantizedDataType(ArrayDataType quantized_data_type, in GetBoundsForQuantizedDataType() 41 case ArrayDataType::kUint8: in GetBoundsForQuantizedDataType() 42 return GetBoundsForQuantizedDataType<ArrayDataType::kUint8>(min, max); in GetBoundsForQuantizedDataType() 43 case ArrayDataType::kInt8: in GetBoundsForQuantizedDataType() 44 return GetBoundsForQuantizedDataType<ArrayDataType::kInt8>(min, max); in GetBoundsForQuantizedDataType() 45 case ArrayDataType::kUint16: in GetBoundsForQuantizedDataType() 46 return GetBoundsForQuantizedDataType<ArrayDataType::kUint16>(min, max); in GetBoundsForQuantizedDataType() 47 case ArrayDataType::kInt16: in GetBoundsForQuantizedDataType() 48 return GetBoundsForQuantizedDataType<ArrayDataType::kInt16>(min, max); in GetBoundsForQuantizedDataType() [all …]
|
D | resolve_multiply_by_zero.cc | 39 template <ArrayDataType Type> 70 if (output_array.data_type == ArrayDataType::kNone) { in Run() 106 case ArrayDataType::kFloat: { in Run() 108 constant_input_array.GetBuffer<ArrayDataType::kFloat>().data; in Run() 109 if (!AreAllBufferElementsZero<DataType<ArrayDataType::kFloat>>( in Run() 113 FillArrayWithZeros<ArrayDataType::kFloat>(&output_array); in Run() 115 case ArrayDataType::kUint8: { in Run() 117 constant_input_array.GetBuffer<ArrayDataType::kUint8>().data; in Run() 118 if (!AreAllBufferElementsZero<DataType<ArrayDataType::kUint8>>( in Run() 122 FillArrayWithZeros<ArrayDataType::kUint8>(&output_array); in Run() [all …]
|
D | propagate_array_data_types.cc | 28 ArrayDataType data_type) { in SetDataTypeForAllOutputs() 45 model->GetArray(input).data_type == ArrayDataType::kNone) { in Run() 51 std::unordered_map<string, ArrayDataType> old_output_data_types; in Run() 60 SetDataTypeForAllOutputs(model, op, ArrayDataType::kFloat); in Run() 73 SetDataTypeForAllOutputs(model, op, ArrayDataType::kBool); in Run() 78 SetDataTypeForAllOutputs(model, op, ArrayDataType::kInt32); in Run() 85 const ArrayDataType data_type = model->GetArray(op->inputs[1]).data_type; in Run() 92 const ArrayDataType data_type = model->GetArray(op->inputs[0]).data_type; in Run() 99 const ArrayDataType data_type = model->GetArray(op->inputs[2]).data_type; in Run() 127 ArrayDataType data_type; in Run() [all …]
|
D | resolve_constant_tile.cc | 71 template <ArrayDataType Type> 79 case ArrayDataType::kInt32: in Tile() 82 multiples_array.GetBuffer<ArrayDataType::kInt32>().data.data(), in Tile() 85 case ArrayDataType::kInt64: in Tile() 88 multiples_array.GetBuffer<ArrayDataType::kInt64>().data.data(), in Tile() 114 if (output_array.data_type == ArrayDataType::kNone) { in Run() 130 CHECK(multiples_array.data_type == ArrayDataType::kInt32 || in Run() 131 multiples_array.data_type == ArrayDataType::kInt64) in Run() 138 case ArrayDataType::kFloat: in Run() 139 Tile<ArrayDataType::kFloat>(input_array, multiples_array, &output_array); in Run() [all …]
|
D | resolve_constant_gather.cc | 27 template <ArrayDataType Type> 35 coords_array.GetBuffer<ArrayDataType::kInt32>().data; in Gather() 81 if (output_array.data_type == ArrayDataType::kNone) { in Run() 108 CHECK(coords_array.data_type == ArrayDataType::kInt32) in Run() 123 case ArrayDataType::kFloat: in Run() 124 Gather<ArrayDataType::kFloat>(input_array, coords_array, &output_array); in Run() 126 case ArrayDataType::kUint8: in Run() 127 Gather<ArrayDataType::kUint8>(input_array, coords_array, &output_array); in Run() 129 case ArrayDataType::kInt32: in Run() 130 Gather<ArrayDataType::kInt32>(input_array, coords_array, &output_array); in Run() [all …]
|
D | resolve_constant_pack.cc | 26 template <ArrayDataType Type> 66 if (output_array.data_type == ArrayDataType::kNone) { in Run() 92 case ArrayDataType::kFloat: in Run() 93 Pack<ArrayDataType::kFloat>(model, *op); in Run() 95 case ArrayDataType::kUint8: in Run() 96 Pack<ArrayDataType::kUint8>(model, *op); in Run() 98 case ArrayDataType::kInt32: in Run() 99 Pack<ArrayDataType::kInt32>(model, *op); in Run() 101 case ArrayDataType::kInt64: in Run() 102 Pack<ArrayDataType::kInt64>(model, *op); in Run() [all …]
|
D | resolve_constant_fill.cc | 24 template <ArrayDataType Type> 59 if (output_array.data_type == ArrayDataType::kNone) { in Run() 81 case ArrayDataType::kFloat: in Run() 82 if (!ComputeFillArray<ArrayDataType::kFloat>(model, op)) { in Run() 86 case ArrayDataType::kUint8: in Run() 87 if (!ComputeFillArray<ArrayDataType::kUint8>(model, op)) { in Run() 91 case ArrayDataType::kInt32: in Run() 92 if (!ComputeFillArray<ArrayDataType::kInt32>(model, op)) { in Run() 96 case ArrayDataType::kInt64: in Run() 97 if (!ComputeFillArray<ArrayDataType::kInt64>(model, op)) { in Run() [all …]
|
D | resolve_constant_concatenation.cc | 35 template <ArrayDataType A, typename T> 78 template <ArrayDataType A> 112 CHECK(concatenated_array->data_type == ArrayDataType::kFloat); in SetMinMaxForConcatenedArray() 180 case ArrayDataType::kFloat: in Run() 181 ConcatenateTensorBuffers<ArrayDataType::kFloat>( in Run() 185 case ArrayDataType::kUint8: in Run() 186 ConcatenateTensorBuffers<ArrayDataType::kUint8>( in Run() 189 case ArrayDataType::kInt32: in Run() 190 ConcatenateTensorBuffers<ArrayDataType::kInt32>( in Run() 193 case ArrayDataType::kInt64: in Run() [all …]
|
D | dequantize.cc | 30 template <ArrayDataType A> 34 array->data_type = ArrayDataType::kFloat; in DequantizeBuffer() 35 auto& new_data = array->GetMutableBuffer<ArrayDataType::kFloat>().data; in DequantizeBuffer() 88 if (array->data_type == ArrayDataType::kUint8) { in DequantizeArray() 89 DequantizeBuffer<ArrayDataType::kUint8>(array); in DequantizeArray() 90 } else if (array->data_type == ArrayDataType::kInt32) { in DequantizeArray() 91 DequantizeBuffer<ArrayDataType::kInt32>(array); in DequantizeArray() 95 CHECK(array->data_type == ArrayDataType::kFloat); in DequantizeArray() 96 CHECK(array->buffer->type == ArrayDataType::kFloat); in DequantizeArray() 102 array->data_type = ArrayDataType::kFloat; in DequantizeArray() [all …]
|
D | resolve_constant_strided_slice.cc | 27 template <ArrayDataType Type> 116 if (output_array.data_type == ArrayDataType::kNone) { in Run() 144 case ArrayDataType::kFloat: in Run() 145 StridedSlice<ArrayDataType::kFloat>(*op, input_array, &output_array); in Run() 147 case ArrayDataType::kUint8: in Run() 148 StridedSlice<ArrayDataType::kUint8>(*op, input_array, &output_array); in Run() 150 case ArrayDataType::kInt32: in Run() 151 StridedSlice<ArrayDataType::kInt32>(*op, input_array, &output_array); in Run() 153 case ArrayDataType::kInt64: in Run() 154 StridedSlice<ArrayDataType::kInt64>(*op, input_array, &output_array); in Run() [all …]
|
D | lstm_utils.cc | 25 void CopyArrayData(const Buffer<ArrayDataType::kFloat>& src_buffer, in CopyArrayData() 27 Buffer<ArrayDataType::kFloat>* dst_buffer, int dst_stride, in CopyArrayData() 41 Buffer<ArrayDataType::kFloat>* CreateFloatArrayBuffer(Model* model, in CreateFloatArrayBuffer() 46 array.data_type = ArrayDataType::kFloat; in CreateFloatArrayBuffer() 48 Buffer<ArrayDataType::kFloat>* buffer = in CreateFloatArrayBuffer() 49 &(array.GetMutableBuffer<ArrayDataType::kFloat>()); in CreateFloatArrayBuffer() 61 Buffer<ArrayDataType::kFloat>* buffer = in CopySubArrayToArray() 63 auto& orig_buffer = original_array.GetBuffer<ArrayDataType::kFloat>(); in CopySubArrayToArray() 71 void CopyArrayToSubArray(Buffer<ArrayDataType::kFloat>& tensor_buffer, in CopyArrayToSubArray() 78 auto& sub_buffer = sub_array.GetBuffer<ArrayDataType::kFloat>(); in CopyArrayToSubArray()
|
D | resolve_constant_slice.cc | 26 template <ArrayDataType Type> 103 if (output_array.data_type == ArrayDataType::kNone) { in Run() 130 case ArrayDataType::kFloat: in Run() 131 if (!Slice<ArrayDataType::kFloat>(*op, input_array, &output_array)) { in Run() 135 case ArrayDataType::kUint8: in Run() 136 if (!Slice<ArrayDataType::kUint8>(*op, input_array, &output_array)) { in Run() 140 case ArrayDataType::kInt32: in Run() 141 if (!Slice<ArrayDataType::kInt32>(*op, input_array, &output_array)) { in Run() 145 case ArrayDataType::kInt64: in Run() 146 if (!Slice<ArrayDataType::kInt64>(*op, input_array, &output_array)) { in Run() [all …]
|
D | quantize.cc | 104 CHECK(array.buffer->type == ArrayDataType::kFloat); in GetOrComputeMinMax() 105 const auto& data = array.GetBuffer<ArrayDataType::kFloat>().data; in GetOrComputeMinMax() 157 template <ArrayDataType A> 170 QuantizationPoints GetQuantizationPoints(ArrayDataType data_type) { in GetQuantizationPoints() 172 case ArrayDataType::kUint8: in GetQuantizationPoints() 173 return GetQuantizationPoints<ArrayDataType::kUint8>(); in GetQuantizationPoints() 174 case ArrayDataType::kInt16: in GetQuantizationPoints() 175 return GetQuantizationPoints<ArrayDataType::kInt16>(); in GetQuantizationPoints() 176 case ArrayDataType::kInt32: in GetQuantizationPoints() 177 return GetQuantizationPoints<ArrayDataType::kInt32>(); in GetQuantizationPoints() [all …]
|
D | resolve_constant_transpose.cc | 28 template <ArrayDataType Type> 118 if (output_array.data_type == ArrayDataType::kNone) { in Run() 146 case ArrayDataType::kFloat: in Run() 147 Transpose<ArrayDataType::kFloat>(model, input_array, op->perm, in Run() 150 case ArrayDataType::kUint8: in Run() 151 Transpose<ArrayDataType::kUint8>(model, input_array, op->perm, in Run() 154 case ArrayDataType::kInt32: in Run() 155 Transpose<ArrayDataType::kInt32>(model, input_array, op->perm, in Run() 158 case ArrayDataType::kInt64: in Run() 159 Transpose<ArrayDataType::kInt64>(model, input_array, op->perm, in Run() [all …]
|
D | resolve_batch_normalization.cc | 51 CHECK(mean_array.data_type == ArrayDataType::kFloat); in Run() 52 CHECK(multiplier_array.data_type == ArrayDataType::kFloat); in Run() 53 CHECK(offset_array.data_type == ArrayDataType::kFloat); in Run() 98 auto& data = mean_array.GetMutableBuffer<ArrayDataType::kFloat>().data; in Run() 112 mul_param_array.data_type = ArrayDataType::kFloat; in Run() 113 add_param_array.data_type = ArrayDataType::kFloat; in Run() 115 mul_param_array.GetMutableBuffer<ArrayDataType::kFloat>().data; in Run() 117 add_param_array.GetMutableBuffer<ArrayDataType::kFloat>().data; in Run() 121 mean_array.GetBuffer<ArrayDataType::kFloat>().data; in Run() 123 multiplier_array.GetBuffer<ArrayDataType::kFloat>().data; in Run() [all …]
|
D | quantization_util.h | 27 const FakeQuantOperator& op, ArrayDataType* out_quantized_data_type); 32 bool GetQuantizedDataTypeNumericalRange(ArrayDataType data_type, 38 ArrayDataType GetQuantizedDataType(const Array& array, 39 ArrayDataType default_type); 44 const Array& array, ArrayDataType quantized_data_type, 50 const string& name, ArrayDataType quantized_data_type,
|
D | resolve_constant_binary.cc | 63 template <ArrayDataType InputsDataType, ArrayDataType OutputDataType> 179 TOCO_HANDLE_CASE(ArrayDataType::kFloat, ArrayDataType::kFloat) in EvaluateBinaryOperatorOnConstantInputs() 180 TOCO_HANDLE_CASE(ArrayDataType::kFloat, ArrayDataType::kBool) in EvaluateBinaryOperatorOnConstantInputs() 181 TOCO_HANDLE_CASE(ArrayDataType::kInt32, ArrayDataType::kInt32) in EvaluateBinaryOperatorOnConstantInputs() 182 TOCO_HANDLE_CASE(ArrayDataType::kInt32, ArrayDataType::kBool) in EvaluateBinaryOperatorOnConstantInputs() 183 TOCO_HANDLE_CASE(ArrayDataType::kInt64, ArrayDataType::kInt64) in EvaluateBinaryOperatorOnConstantInputs() 184 TOCO_HANDLE_CASE(ArrayDataType::kInt64, ArrayDataType::kBool) in EvaluateBinaryOperatorOnConstantInputs()
|
D | resolve_constant_unary.cc | 185 std::vector<DataType<ArrayDataType::kFloat>> const* input_float_data; in Run() 188 if (cast_op->dst_data_type != ArrayDataType::kFloat) { in Run() 202 if (input_array.buffer->type != ArrayDataType::kFloat) { in Run() 205 input_float_data = &(input_array.GetBuffer<ArrayDataType::kFloat>().data); in Run() 213 output_array.GetMutableBuffer<ArrayDataType::kFloat>().data; in Run() 221 if (input_array.buffer->type == ArrayDataType::kFloat) { in Run() 223 input_array.GetBuffer<ArrayDataType::kFloat>().data[i]); in Run() 224 } else if (input_array.buffer->type == ArrayDataType::kUint8) { in Run() 226 input_array.GetBuffer<ArrayDataType::kUint8>().data[i]); in Run() 227 } else if (input_array.buffer->type == ArrayDataType::kInt32) { in Run() [all …]
|
/external/tensorflow/tensorflow/lite/toco/tflite/ |
D | types.cc | 26 const auto& src_data = array.GetBuffer<ArrayDataType::kString>().data; in CopyStringToBuffer() 45 const auto& src_data = array.GetBuffer<ArrayDataType::kBool>().data; in CopyBoolToBuffer() 49 template <ArrayDataType T> 62 &array->GetMutableBuffer<ArrayDataType::kString>().data; in CopyStringFromBuffer() 71 template <ArrayDataType T> 87 ::tflite::TensorType DataType::Serialize(ArrayDataType array_data_type) { in Serialize() 89 case ArrayDataType::kFloat: in Serialize() 91 case ArrayDataType::kInt16: in Serialize() 93 case ArrayDataType::kInt32: in Serialize() 95 case ArrayDataType::kInt64: in Serialize() [all …]
|
D | types_test.cc | 33 static const ArrayDataType kUnsupportedTocoTypes[] = {ArrayDataType::kNone}; 44 template <ArrayDataType T> 71 std::vector<std::pair<ArrayDataType, ::tflite::TensorType>> testdata = { in TEST() 72 {ArrayDataType::kUint8, ::tflite::TensorType_UINT8}, in TEST() 73 {ArrayDataType::kInt32, ::tflite::TensorType_INT32}, in TEST() 74 {ArrayDataType::kInt64, ::tflite::TensorType_INT64}, in TEST() 75 {ArrayDataType::kFloat, ::tflite::TensorType_FLOAT32}, in TEST() 76 {ArrayDataType::kBool, ::tflite::TensorType_BOOL}, in TEST() 77 {ArrayDataType::kComplex64, ::tflite::TensorType_COMPLEX64}}; in TEST() 90 for (ArrayDataType t : kUnsupportedTocoTypes) { in TEST() [all …]
|
/external/tensorflow/tensorflow/lite/toco/ |
D | tooling_util.cc | 66 string ArrayDataTypeName(ArrayDataType data_type) { in ArrayDataTypeName() 68 case ArrayDataType::kFloat: in ArrayDataTypeName() 70 case ArrayDataType::kInt8: in ArrayDataTypeName() 72 case ArrayDataType::kUint8: in ArrayDataTypeName() 74 case ArrayDataType::kInt16: in ArrayDataTypeName() 76 case ArrayDataType::kUint16: in ArrayDataTypeName() 78 case ArrayDataType::kInt32: in ArrayDataTypeName() 80 case ArrayDataType::kUint32: in ArrayDataTypeName() 82 case ArrayDataType::kInt64: in ArrayDataTypeName() 84 case ArrayDataType::kUint64: in ArrayDataTypeName() [all …]
|
D | import_tensorflow_test.cc | 264 template <ArrayDataType T> 287 constexpr ArrayDataType kType = ArrayDataType::kInt32; in TEST_F() 300 constexpr ArrayDataType kType = ArrayDataType::kInt64; in TEST_F() 313 constexpr ArrayDataType kType = ArrayDataType::kUint8; in TEST_F() 326 constexpr ArrayDataType kType = ArrayDataType::kBool; in TEST_F() 339 constexpr ArrayDataType kType = ArrayDataType::kFloat; in TEST_F() 355 constexpr ArrayDataType kType = ArrayDataType::kComplex64; in TEST_F() 381 std::vector<std::pair<tensorflow::DataType, ArrayDataType>> UnaryTestTypes() { in UnaryTestTypes() 382 return {{DT_FLOAT, ArrayDataType::kFloat}, in UnaryTestTypes() 383 {DT_INT32, ArrayDataType::kInt32}, in UnaryTestTypes() [all …]
|
D | model.h | 209 enum class ArrayDataType : uint8 { enum 226 template <ArrayDataType A> 229 struct DataTypeImpl<ArrayDataType::kNone> { 233 struct DataTypeImpl<ArrayDataType::kBool> { 237 struct DataTypeImpl<ArrayDataType::kFloat> { 241 struct DataTypeImpl<ArrayDataType::kInt8> { 245 struct DataTypeImpl<ArrayDataType::kUint8> { 249 struct DataTypeImpl<ArrayDataType::kInt16> { 253 struct DataTypeImpl<ArrayDataType::kUint16> { 257 struct DataTypeImpl<ArrayDataType::kInt32> { [all …]
|