tensorflow::ops::Dequantize
#include <array_ops.h>แปลง เทนเซอร์ 'อินพุต' ให้เป็น เทนเซอร์ ประเภท float หรือ bfloat16
สรุป
[min_range, max_range] เป็นค่าทศนิยมแบบสเกลาร์ที่ระบุช่วงสำหรับผลลัพธ์ คุณสมบัติ 'mode' จะควบคุมการคำนวณที่ใช้ในการแปลงค่าทศนิยมเป็นค่าควอนไทซ์อย่างแม่นยำ
ในโหมด 'MIN_COMBINED' ค่าแต่ละค่าของเทนเซอร์จะได้รับการประมวลผลดังต่อไปนี้:
if T == qint8: in[i] += (range(T) + 1)/ 2.0 out[i] = min_range + (in[i]* (max_range - min_range) / range(T))
range(T) = numeric_limits ::max() - numeric_limits ::min() ตัวอย่างโหมด MIN_COMBINED
ถ้าอินพุตมาจาก QuantizedRelu6 ประเภทของเอาต์พุตจะเป็น quint8 (ช่วง 0-255) แต่ช่วงที่เป็นไปได้ของ QuantizedRelu6 คือ 0-6 ดังนั้นค่า min_range และ max_range จึงเป็น 0.0 และ 6.0 ตามลำดับ การแปลงค่า แบบ dequantize บน quint8 จะนำแต่ละค่ามาแปลงเป็น float แล้วคูณด้วย 6 / 255 โปรดทราบว่าถ้า quantizedtype เป็น qint8 การดำเนินการจะเพิ่มค่าแต่ละค่าด้วย 128 ก่อนที่จะแปลงประเภทด้วย
หากตั้งค่าโหมดเป็น 'MIN_FIRST' จะใช้วิธีการดังนี้:
num_discrete_values = 1 << (# of bits in T) range_adjust = num_discrete_values / (num_discrete_values - 1) range = (range_max - range_min) * range_adjust range_scale = range / num_discrete_values const double offset_input = static_cast(input) - lowest_quantized; result = range_min + ((input - numeric_limits ::min()) * range_scale)
หากโหมดเป็น SCALED การลดปริมาณข้อมูลจะทำโดยการคูณค่าอินพุตแต่ละค่าด้วยตัวคูณ (ดังนั้น ค่าอินพุต 0 จะถูกแปลงเป็น 0.0 เสมอ)
ค่า scaling_factor จะถูกกำหนดจาก min_range , max_range และ narrow_range ในลักษณะที่เข้ากันได้กับ QuantizeAndDequantize{V2|V3} และ QuantizeV2 โดยใช้อัลกอริทึมต่อไปนี้:
const int min_expected_T = std::numeric_limits::min() + (narrow_range ? 1 : 0); const int max_expected_T = std::numeric_limits ::max(); const float max_expected_T = std::numeric_limits ::max();
const float scale_factor = (std::numeric_limits::min() == 0) ? (max_range / max_expected_T) : std::max(min_range / min_expected_T, max_range / max_expected_T);
ข้อโต้แย้ง:
- ขอบเขต: วัตถุ ขอบเขต
- min_range: ค่าสเกลาร์ต่ำสุดที่เป็นไปได้สำหรับข้อมูลที่ป้อนเข้ามา
- max_range: ค่าสเกลาร์สูงสุดที่เป็นไปได้สำหรับข้อมูลที่ป้อนเข้ามา
คุณลักษณะเสริม (ดูที่ Attrs ):
- dtype: ชนิดของเทนเซอร์เอาต์พุต ปัจจุบัน Dequantize รองรับ float และ bfloat16 หาก 'dtype' เป็น 'bfloat16' จะรองรับเฉพาะโหมด 'MIN_COMBINED' เท่านั้น
การส่งคืนสินค้า:
-
Output: เทนเซอร์เอาต์พุต
ตัวสร้างและตัวทำลาย | |
|---|---|
Dequantize (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input min_range, :: tensorflow::Input max_range) | |
Dequantize (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input min_range, :: tensorflow::Input max_range, const Dequantize::Attrs & attrs) |
คุณลักษณะสาธารณะ | |
|---|---|
operation | |
output | |
หน้าที่สาธารณะ | |
|---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const | |
ฟังก์ชันคงที่สาธารณะ | |
|---|---|
Axis (int64 x) | |
Dtype (DataType x) | |
Mode (StringPiece x) | |
NarrowRange (bool x) | |
โครงสร้าง | |
|---|---|
| tensorflow::ops::Dequantize::Attrs | ตัวเลือกการตั้งค่าแอตทริบิวต์สำหรับ Dequantize |
คุณลักษณะสาธารณะ
การดำเนินการ
Operation operation
เอาต์พุต
::tensorflow::Output output
หน้าที่สาธารณะ
ลดปริมาณ
Dequantize( const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input min_range, ::tensorflow::Input max_range )
ลดปริมาณ
Dequantize( const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input min_range, ::tensorflow::Input max_range, const Dequantize::Attrs & attrs )
โหนด
::tensorflow::Node * node() const
ตัวดำเนินการ::เทนเซอร์โฟลว์::อินพุต
operator::tensorflow::Input() const
ตัวดำเนินการ::เทนเซอร์โฟลว์::เอาต์พุต
operator::tensorflow::Output() const
ฟังก์ชันคงที่สาธารณะ
แกน
Attrs Axis( int64 x )
ประเภท D
Attrs Dtype( DataType x )
โหมด
Attrs Mode( StringPiece x )
ช่วงแคบ
Attrs NarrowRange( bool x )