tensorflow:: ops:: Dequantize

#include <array_ops.h>

Descuantiza el tensor de 'entrada' en un tensor de tipo float.

Resumen

[min_range, max_range] are scalar floats that specify the range for the output. The 'mode' attribute controls exactly which calculations are used to convert the float values to their quantized equivalents.

En el modo 'MIN_COMBINED', cada valor del tensor se someterá a lo siguiente:

if T == qint8: in[i] += (range(T) + 1)/ 2.0
out[i] = min_range + (in[i]* (max_range - min_range) / range(T))
aquí range(T) = numeric_limits ::max() - numeric_limits ::min()

Ejemplo de modo MIN_COMBINED

Si la entrada proviene de una QuantizedRelu6 , el tipo de salida es quint8 (rango de 0 a 255), pero el rango posible de QuantizedRelu6 es de 0 a 6. Por lo tanto, los valores min_range y max_range son 0,0 y 6,0. La dequantize en quint8 tomará cada valor, lo convertirá a float y lo multiplicará por 6 / 255. Tenga en cuenta que si quantizedtype es qint8, la operación también sumará 128 a cada valor antes de la conversión.

Si el modo es 'MIN_FIRST', entonces se utiliza este enfoque:

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)

Si el modo es SCALED , la descuantización se realiza multiplicando cada valor de entrada por un factor de escala. (Por lo tanto, una entrada de 0 siempre se asigna a 0,0).

El factor de escala se determina a partir de min_range , max_range y narrow_range de una manera compatible con QuantizeAndDequantize{V2|V3} y QuantizeV2 , utilizando el siguiente algoritmo:

  

  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);

Argumentos:

  • ámbito: Un objeto de ámbito
  • min_range: El valor escalar mínimo que se puede producir para la entrada.
  • max_range: El valor escalar máximo que se puede producir para la entrada.

Devoluciones:

  • Output : El tensor de salida.

Constructores y destructores

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)

Atributos públicos

operation
output

Funciones públicas

node () const
::tensorflow::Node *
operator::tensorflow::Input () const
operator::tensorflow::Output () const

funciones estáticas públicas

Axis (int64 x)
Mode (StringPiece x)
NarrowRange (bool x)

Estructuras

tensorflow:: ops:: Dequantize:: Attrs

Configuradores de atributos opcionales para Dequantize .

Atributos públicos

operación

Operation operation

producción

::tensorflow::Output output

Funciones públicas

Descuantificar

 Dequantize(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input input,
  ::tensorflow::Input min_range,
  ::tensorflow::Input max_range
)

Descuantificar

 Dequantize(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input input,
  ::tensorflow::Input min_range,
  ::tensorflow::Input max_range,
  const Dequantize::Attrs & attrs
)

nodo

::tensorflow::Node * node() const 

operador::tensorflow::Input

 operator::tensorflow::Input() const 

operador::tensorflow::Salida

 operator::tensorflow::Output() const 

funciones estáticas públicas

Eje

Attrs Axis(
  int64 x
)

Modo

Attrs Mode(
  StringPiece x
)

Rango estrecho

Attrs NarrowRange(
  bool x
)