diff options
Diffstat (limited to 'neuralnetworks/1.0/types.hal')
-rw-r--r-- | neuralnetworks/1.0/types.hal | 52 |
1 files changed, 48 insertions, 4 deletions
diff --git a/neuralnetworks/1.0/types.hal b/neuralnetworks/1.0/types.hal index 4efa13ad..1ae1726c 100644 --- a/neuralnetworks/1.0/types.hal +++ b/neuralnetworks/1.0/types.hal | |||
@@ -1519,6 +1519,41 @@ struct Operand { | |||
1519 | 1519 | ||
1520 | /** | 1520 | /** |
1521 | * Dimensions of the operand. | 1521 | * Dimensions of the operand. |
1522 | * | ||
1523 | * For a scalar operand, dimensions.size() must be 0. | ||
1524 | * | ||
1525 | * For a tensor operand, dimensions.size() must be at least 1; | ||
1526 | * however, any of the dimensions may be unspecified. | ||
1527 | * | ||
1528 | * A tensor operand with all dimensions specified has "fully | ||
1529 | * specified" dimensions. Whenever possible (i.e., whenever the | ||
1530 | * dimensions are known at model construction time), a tensor | ||
1531 | * operand should have (but is not required to have) fully | ||
1532 | * specified dimensions, in order to enable the best possible | ||
1533 | * performance. | ||
1534 | * | ||
1535 | * If a tensor operand's dimensions are not fully specified, the | ||
1536 | * dimensions of the operand are deduced from the operand | ||
1537 | * dimensions and values of the operation for which that operand | ||
1538 | * is an output. | ||
1539 | * | ||
1540 | * In the following situations, a tensor operand's dimensions must | ||
1541 | * be fully specified: | ||
1542 | * | ||
1543 | * . The operand has lifetime CONSTANT_COPY or | ||
1544 | * CONSTANT_REFERENCE. | ||
1545 | * | ||
1546 | * . The operand has lifetime MODEL_INPUT or MODEL_OUTPUT. Fully | ||
1547 | * specified dimensions must either be present in the | ||
1548 | * Operand or they must be provided in the corresponding | ||
1549 | * RequestArgument. | ||
1550 | * EXCEPTION: If the input or output is optional and omitted | ||
1551 | * (by setting the hasNoValue field of the corresponding | ||
1552 | * RequestArgument to true) then it need not have fully | ||
1553 | * specified dimensions. | ||
1554 | * | ||
1555 | * A tensor operand with some number of unspecified dimensions is | ||
1556 | * represented by setting each unspecified dimension to 0. | ||
1522 | */ | 1557 | */ |
1523 | vec<uint32_t> dimensions; | 1558 | vec<uint32_t> dimensions; |
1524 | 1559 | ||
@@ -1662,10 +1697,19 @@ struct RequestArgument { | |||
1662 | /** | 1697 | /** |
1663 | * Updated dimension information. | 1698 | * Updated dimension information. |
1664 | * | 1699 | * |
1665 | * If dimensions.size() > 0, dimension information was provided along with | 1700 | * If dimensions.size() > 0, dimension information was provided |
1666 | * the argument. This can be the case for models that accept inputs of | 1701 | * along with the argument. This can be the case for models that |
1667 | * varying size. This can't change the rank, just the value of the | 1702 | * accept inputs of varying size. This can't change the rank, just |
1668 | * dimensions that were unspecified in the model. | 1703 | * the value of the dimensions that were unspecified in the |
1704 | * model. If dimensions.size() > 0, then all dimensions must be | ||
1705 | * specified here; and any dimension that was specified in the | ||
1706 | * model must have the same value here. | ||
1707 | * | ||
1708 | * If the dimensions in the model are not fully specified, then | ||
1709 | * they must be fully specified here, unless hasNoValue is set to | ||
1710 | * true. If the dimensions in the model are fully specified, then | ||
1711 | * either dimensions.size() may be 0, or the dimensions in the | ||
1712 | * model must be identical to the dimensions here. | ||
1669 | */ | 1713 | */ |
1670 | vec<uint32_t> dimensions; | 1714 | vec<uint32_t> dimensions; |
1671 | }; | 1715 | }; |