จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เทนเซอร์โฟลว์:: ปฏิบัติการ:: QuantizeDownAndShrinkRange
#include <math_ops.h>
แปลงเทนเซอร์ 'อินพุต' เชิงปริมาณให้เป็น 'เอาต์พุต' ที่มีความแม่นยำต่ำกว่า โดยใช้
สรุป
การกระจายค่าตามจริงเพื่อเพิ่มการใช้งานความลึกบิตล่างให้สูงสุด และปรับช่วงต่ำสุดและสูงสุดเอาต์พุตตามลำดับ
[input_min, input_max] เป็นสเกลาร์โฟลตที่ระบุช่วงสำหรับการตีความโฟลตของข้อมูล 'อินพุต' ตัวอย่างเช่น หาก input_min คือ -1.0f และ input_max คือ 1.0f และเรากำลังจัดการกับข้อมูลเชิงปริมาณ quint16 ดังนั้นค่า 0 ในข้อมูล 16 บิตควรถูกตีความว่าเป็น -1.0f และ 65535 หมายถึง 1.0f
โอเปอเรเตอร์นี้พยายามบีบความแม่นยำให้มากที่สุดเท่าที่จะเป็นไปได้ในเอาต์พุตที่มีความลึกบิตต่ำลง โดยการคำนวณค่าต่ำสุดและสูงสุดจริงที่พบในข้อมูล ตัวอย่างเช่น บางทีอินพุต quint16 นั้นไม่มีค่าใดต่ำกว่า 16,384 และไม่มีค่าใดที่สูงกว่า 49,152 นั่นหมายความว่าจริงๆ แล้วจำเป็นต้องใช้ช่วงเพียงครึ่งเดียวเท่านั้น การตีความแบบลอยตัวทั้งหมดจะอยู่ระหว่าง -0.5f ถึง 0.5f ดังนั้น หากเราต้องการบีบอัดข้อมูลลงในเอาต์พุต quint8 เราสามารถใช้ช่วงนั้นแทนตามทฤษฎี -1.0f ถึง 1.0 f ที่แนะนำโดยอินพุต min และ max
ในทางปฏิบัติ สิ่งนี้มีประโยชน์มากที่สุดสำหรับการรับเอาต์พุตจากการดำเนินการ เช่น QuantizedMatMul ที่สามารถสร้างเอาต์พุตที่มีความลึกบิตสูงกว่าอินพุต และอาจมีช่วงเอาต์พุตที่มีศักยภาพสูง แต่ในทางปฏิบัติมีการกระจายของค่าอินพุตที่ใช้เพียงเศษส่วนเล็กน้อยของ ช่วงที่เป็นไปได้ ด้วยการป้อนเอาต์พุตนั้นเข้าไปในโอเปอเรเตอร์นี้ เราสามารถลดจาก 32 บิตเหลือ 8 ได้โดยสูญเสียความแม่นยำน้อยที่สุด
ข้อโต้แย้ง:
- ขอบเขต: วัตถุ ขอบเขต
- input_min: ค่าทศนิยมที่ค่าอินพุตเชิงปริมาณขั้นต่ำเป็นตัวแทน
- input_max: ค่าทศนิยมที่ค่าอินพุตเชิงปริมาณสูงสุดเป็นตัวแทน
- out_type: ประเภทของเอาต์พุต ควรมีความลึกบิตต่ำกว่า Tinput
ผลตอบแทน:
-
Output
เอาท์พุต -
Output
output_min: ค่าทศนิยมที่ค่าเอาต์พุตเชิงปริมาณขั้นต่ำแสดงถึง -
Output
output_max: ค่าทศนิยมที่ค่าเอาต์พุตเชิงปริมาณสูงสุดแสดงถึง
คุณลักษณะสาธารณะ
งานสาธารณะ
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-27 UTC
[null,null,["อัปเดตล่าสุด 2025-07-27 UTC"],[],[],null,["# tensorflow::ops::QuantizeDownAndShrinkRange Class Reference\n\ntensorflow::ops::QuantizeDownAndShrinkRange\n===========================================\n\n`#include \u003cmath_ops.h\u003e`\n\nConvert the quantized 'input' tensor into a lower-precision 'output', using the.\n\nSummary\n-------\n\nactual distribution of the values to maximize the usage of the lower bit depth and adjusting the output min and max ranges accordingly.\n\n\\[input_min, input_max\\] are scalar floats that specify the range for the float interpretation of the 'input' data. For example, if input_min is -1.0f and input_max is 1.0f, and we are dealing with quint16 quantized data, then a 0 value in the 16-bit data should be interpreted as -1.0f, and a 65535 means 1.0f.\n\nThis operator tries to squeeze as much precision as possible into an output with a lower bit depth by calculating the actual min and max values found in the data. For example, maybe that quint16 input has no values lower than 16,384 and none higher than 49,152. That means only half the range is actually needed, all the float interpretations are between -0.5f and 0.5f, so if we want to compress the data into a quint8 output, we can use that range rather than the theoretical -1.0f to 1.0f that is suggested by the input min and max.\n\nIn practice, this is most useful for taking output from operations like [QuantizedMatMul](/versions/r2.2/api_docs/cc/class/tensorflow/ops/quantized-mat-mul#classtensorflow_1_1ops_1_1_quantized_mat_mul) that can produce higher bit-depth outputs than their inputs and may have large potential output ranges, but in practice have a distribution of input values that only uses a small fraction of the possible range. By feeding that output into this operator, we can reduce it from 32 bits down to 8 with minimal loss of accuracy.\n\nArguments:\n\n- scope: A [Scope](/versions/r2.2/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- input_min: The float value that the minimum quantized input value represents.\n- input_max: The float value that the maximum quantized input value represents.\n- out_type: The type of the output. Should be a lower bit depth than Tinput.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.2/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) output\n- [Output](/versions/r2.2/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) output_min: The float value that the minimum quantized output value represents.\n- [Output](/versions/r2.2/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) output_max: The float value that the maximum quantized output value represents.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [QuantizeDownAndShrinkRange](#classtensorflow_1_1ops_1_1_quantize_down_and_shrink_range_1a19ee578c7b888e9aca48d291a1a0d5da)`(const ::`[tensorflow::Scope](/versions/r2.2/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_min, ::`[tensorflow::Input](/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input_max, DataType out_type)` ||\n\n| ### Public attributes ||\n|-------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_quantize_down_and_shrink_range_1a3ab13cf6f6f7814f990022d1a49b3a99) | [Operation](/versions/r2.2/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_quantize_down_and_shrink_range_1a02ce18813489b86884040f42ddcfca87) | `::`[tensorflow::Output](/versions/r2.2/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [output_max](#classtensorflow_1_1ops_1_1_quantize_down_and_shrink_range_1a3c2857dfc27b8777dc82845ec0a4919a) | `::`[tensorflow::Output](/versions/r2.2/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n| [output_min](#classtensorflow_1_1ops_1_1_quantize_down_and_shrink_range_1aa8dddbbd62576e4961029ce5ed846677) | `::`[tensorflow::Output](/versions/r2.2/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### output\n\n```text\n::tensorflow::Output output\n``` \n\n### output_max\n\n```scdoc\n::tensorflow::Output output_max\n``` \n\n### output_min\n\n```scdoc\n::tensorflow::Output output_min\n``` \n\nPublic functions\n----------------\n\n### QuantizeDownAndShrinkRange\n\n```gdscript\n QuantizeDownAndShrinkRange(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n ::tensorflow::Input input_min,\n ::tensorflow::Input input_max,\n DataType out_type\n)\n```"]]