tensorflow :: ops :: Dequantize
#include <array_ops.h>
Dekuantize bir banyoya veya bfloat16 'giriş' tensörünün Tensörünün .
Özet
[min_aralık, maks_aralık], çıktı için aralığı belirleyen skaler kayan değerlerdir. 'Mode' özelliği, float değerlerini nicelleştirilmiş eşdeğerlerine dönüştürmek için tam olarak hangi hesaplamaların kullanıldığını kontrol eder.
'MIN_COMBINED' modunda, tensörün her bir değeri aşağıdakilerden geçecektir:
if T == qint8: in[i] += (range(T) + 1)/ 2.0 out[i] = min_range + (in[i]* (max_range - min_range) / range(T))burada
range(T) = numeric_limits ::max() - numeric_limits ::min()
range(T) = numeric_limits ::max() - numeric_limits ::min()
range(T) = numeric_limits ::max() - numeric_limits ::min()
MIN_COMBINED Modu Örneği
Giriş bir QuantizedRelu6'dan geliyorsa, çıkış türü quint8'dir (0-255 aralığı) ancak QuantizedRelu6'nın olası aralığı 0-6'dır. Min_aralık ve maks_aralık değerleri bu nedenle 0.0 ve 6.0'dır. Quint8 üzerinde Dequantize her bir değeri alır, float'a dönüştürür ve 6/255 ile çarpılır . Quantizedtype qint8 ise, işlemin dökümden önce her değeri 128 ile ekleyeceğini unutmayın.
Mod 'MIN_FIRST' ise, bu yaklaşım kullanılır:
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)
Modu ise SCALED
, dekuantizasyon bir scaling_factor ile her bir giriş değeri ile çarpılarak gerçekleştirilir. (Böylece 0 girişi her zaman 0,0 ile eşleşir).
Ölçeklendirme min_range
, aşağıdaki algoritma kullanılarak QuantizeAndDequantize{V2|V3}
ve QuantizeV2
ile uyumlu bir şekilde min_range
, max_range
ve narrow_range
belirlenir:
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); Argümanlar:
- kapsam: Bir Scope nesnesi
- min_range: Giriş için muhtemelen üretilmiş minimum skaler değer.
- maks_aralık: Giriş için muhtemelen üretilen maksimum skaler değer.
İsteğe bağlı özellikler (bkz. Attrs
):
- dtype: Çıkış tensörünün türü. Şu anda Dequantize float ve bfloat16'yı desteklemektedir. "Dtype" "bfloat16" ise, yalnızca "MIN_COMBINED" modunu destekler.
İadeler:
-
Output
: Çıktı tensörü.
Yapıcılar ve Yıkıcılar | |
---|---|
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) |
Genel özellikler | |
---|---|
operation | |
output |
Kamusal işlevler | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
Genel statik işlevler | |
---|---|
Axis (int64 x) | |
Dtype (DataType x) | |
Mode (StringPiece x) | |
NarrowRange (bool x) |
Yapılar | |
---|---|
tensorflow :: ops :: Dequantize :: Attrs | Dequantize için isteğe bağlı öznitelik belirleyiciler. |
Genel özellikler
operasyon
Operation operation
çıktı
::tensorflow::Output output
Kamusal işlevler
Dequantize
Dequantize( const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input min_range, ::tensorflow::Input max_range )
Dequantize
Dequantize( const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input min_range, ::tensorflow::Input max_range, const Dequantize::Attrs & attrs )
düğüm
::tensorflow::Node * node() const
operator :: tensorflow :: Girdi
operator::tensorflow::Input() const
operator :: tensorflow :: Çıktı
operator::tensorflow::Output() const
Genel statik işlevler
Eksen
Attrs Axis( int64 x )
Dtype
Attrs Dtype( DataType x )
Mod
Attrs Mode( StringPiece x )
NarrowRange
Attrs NarrowRange( bool x )