namespace operand
{
-Index Set::append(const Shape &shape, int32_t type)
+Index Set::append(const Shape &shape, int32_t type, float scale, int32_t zeroPoint)
{
int32_t index = _objects.size();
- _objects.emplace_back(new Object{shape, type});
+ _objects.emplace_back(new Object{shape, type, scale, zeroPoint});
return Index{index};
}
class Object
{
public:
- explicit Object(const Shape &shape, const int32_t type) : _shape{shape}, _type{type}
+ explicit Object(const Shape &shape, const int32_t type, const float scale,
+ const int32_t zeroPoint)
+ : _shape{shape}, _type{type}, _scale{scale}, _zeroPoint{zeroPoint}
{
// DO NOTHING
}
public:
const Shape &shape(void) const { return _shape; }
const int32_t type(void) const { return _type; }
+ const float scale(void) const { return _scale; }
+ const int32_t zeroPoint(void) const { return _zeroPoint; }
private:
void data(std::unique_ptr<Data> &&data) { _data = std::move(data); }
private:
const Shape _shape;
const int32_t _type;
+ const float _scale;
+ const int32_t _zeroPoint;
std::unique_ptr<Data> _data;
};
}
public:
- Index append(const Shape &, int32_t type);
+ Index append(const Shape &, int32_t type, float scale, int32_t zeroPoint);
public:
const Object &at(const Index &) const;
{
// ASSUME A tensor operand should consists of fp32 or int32 values.
// NOTE We do not care about scala operands.
- assert((type->dimensionCount == 0) || (type->type == 3 /* ANEURALNETWORKS_TENSOR_FLOAT32 */ ||
- type->type == 4 /* ANEURALNETWORKS_TENSOR_INT32 */));
+ assert((type->dimensionCount == 0) || (type->type == ANEURALNETWORKS_TENSOR_FLOAT32 ||
+ type->type == ANEURALNETWORKS_TENSOR_INT32 ||
+ type->type == ANEURALNETWORKS_TENSOR_QUANT8_ASYMM));
internal::tflite::operand::Shape shape(type->dimensionCount);
shape.dim(axis) = type->dimensions[axis];
}
- model->deref().operands().append(shape, type->type);
+ model->deref().operands().append(shape, type->type, type->scale, type->zeroPoint);
// NOTE We do NOT allocate CLTensor here as we do not how to interpret this one.
// TensorFlow Lite may interpret a rank-4 tensor either as a feature map (with batch) or