auto type = operands.at(operand_idx).type();
auto shape = operands.at(operand_idx).shape();
+ // Need to support scalar types (ANEURALNETWORKS_FLOAT32 and ANEURALNETWORKS_INT32)
+ // for rank > 1 tensor, because it can be operand of broadcast operation
switch (rank)
{
case 0: // scalar
auto size = shape.asVector();
switch (type)
{
+ case ANEURALNETWORKS_FLOAT32:
case ANEURALNETWORKS_TENSOR_FLOAT32:
{
auto initializer = std::bind(initVectorTensor<float>, _1, base, size);
_plan.operands().at(operand_idx).access(initializer);
break;
}
+ case ANEURALNETWORKS_INT32:
case ANEURALNETWORKS_TENSOR_INT32:
{
auto initializer = std::bind(initVectorTensor<int32_t>, _1, base, size);
auto size = operands.at(operand_idx).data().size();
switch (type)
{
+ case ANEURALNETWORKS_FLOAT32:
case ANEURALNETWORKS_TENSOR_FLOAT32:
{
auto initializer = std::bind(initMatrixTensor<float>, _1, matrix_shape, base, size);
_plan.operands().at(operand_idx).access(initializer);
break;
}
+ case ANEURALNETWORKS_INT32:
case ANEURALNETWORKS_TENSOR_INT32:
{
auto initializer = std::bind(initMatrixTensor<int32_t>, _1, matrix_shape, base, size);
auto size = operands.at(operand_idx).data().size();
switch (type)
{
+ case ANEURALNETWORKS_FLOAT32:
case ANEURALNETWORKS_TENSOR_FLOAT32:
{
auto initializer = std::bind(initTensor3D<float>, _1, tensor_shape, base, size);
_plan.operands().at(operand_idx).access(initializer);
break;
}
+ case ANEURALNETWORKS_INT32:
case ANEURALNETWORKS_TENSOR_INT32:
{
auto initializer = std::bind(initTensor3D<int32_t>, _1, tensor_shape, base, size);
auto size = operands.at(operand_idx).data().size();
switch (type)
{
+ case ANEURALNETWORKS_FLOAT32:
case ANEURALNETWORKS_TENSOR_FLOAT32:
{
auto initializer = std::bind(initFeatureTensor<float>, _1, feature_shape, base, size);
_plan.operands().at(operand_idx).access(initializer);
break;
}
+ case ANEURALNETWORKS_INT32:
case ANEURALNETWORKS_TENSOR_INT32:
{
auto initializer =