Caffe2 - C++ API
A deep learning, cross platform ML framework
math.h
1 #pragma once
2 
3 #include <cstdint>
4 
5 namespace caffe2 {
6 
7 namespace math {
8 
9 // Returns the quantized and compressed values of floating inputs
10 // The "fused" representation stores the [bitwidth][tail][min][max]
11 // with the quantized data in one array. Since we store 8/bitwidth
12 // quantized data in one byte, the last buckets of some bytes may have
13 // unused bits. There are totally tail buckets are unused.
14 // We encode *bitwidth* and *tail* at the beginning,
15 // following by 32-bit floating data respresenting min and max.
16 // | bitwidth | tail | min | max | ... int8 data ... |
17 // | 1B | 1B | 4B | 4B | ...output_data....|
18 // In output_data: the b-th bucket of the i-th byte stores
19 // the i-th data of the b-th segment of input row
20 
21 void quantize_and_compress(
22  const float* input_data,
23  std::uint8_t* output_data,
24  std::uint64_t input_size,
25  std::uint64_t bitwidth,
26  bool random,
27  const float* random_buffer);
28 
29 void decompress_and_dequantize(
30  const std::uint8_t* input_data,
31  float* output_data,
32  std::uint64_t input_size);
33 
34 } // namespace math
35 } // namespace caffe2
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
Definition: blob.h:13