shape.dim(axis) = type->dimensions[axis];
}
- shape.set(type->type, type->scale, type->zeroPoint);
-
model->deref().addOperand(shape, typeInfo);
// NOTE We do NOT allocate CLTensor here as we do not how to interpret this one.
elements *= _shape.dim(rank);
}
- int32_t type = _shape.type();
+ DataType type = _type.type();
size_t element_size = 0;
// Value of type is matched with OperandCode enum in NeuralNetworks.h
switch (type)
{
- case 0: // ANEURALNETWORKS_FLOAT32
- case 3: // ANEURALNETWORKS_TENSOR_FLOAT32
+ case DataType::SCALAR_FLOAT32:
+ case DataType::TENSOR_FLOAT32:
element_size = sizeof(float);
break;
- case 1: // ANEURALNETWORKS_INT32
- case 4: // ANEURALNETWORKS_TENSOR_INT32
+ case DataType::SCALAR_INT32:
+ case DataType::TENSOR_INT32:
element_size = sizeof(int32_t);
break;
- case 2: // ANEURALNETWORKS_UINT32
+ case DataType::SCALAR_UINT32:
element_size = sizeof(uint32_t);
break;
- case 5: // ANEURALNETWORKS_TENSOR_QUANT8_ASYMM
+ case DataType::TENSOR_QUANT8_ASYMM:
element_size = sizeof(uint8_t);
break;
default:
int32_t dim(uint32_t n) const { return _dims.at(n); }
int32_t &dim(uint32_t n) { return _dims.at(n); }
const std::vector<int32_t> &dims() const { return _dims; }
- int32_t type() const { return _type; }
- float scale() const { return _scale; }
- int32_t offset() const { return _offset; }
- void set(int32_t type, float scale, int32_t offset)
- {
- _type = type;
- _scale = scale;
- _offset = offset;
- }
public:
int32_t asVector(void) const;
private:
std::vector<int32_t> _dims;
- // TODO: type, scale, offset should be moved to any other class.
- int32_t _type;
- float _scale;
- int32_t _offset;
};
} // namespace operand
shape.type = static_cast<OperandType>(static_cast<int32_t>(o.typeInfo().type()));
shape.dimensions = std::vector<uint32_t>(o.shape().dims().begin(), o.shape().dims().end());
- shape.scale = o.shape().scale();
+ shape.scale = o.typeInfo().scale();
// shape.offset = _offset;
return shape;