| CPC G06N 20/00 (2019.01) | 11 Claims |

|
1. A method performed by one or more computers, the method comprising:
detecting an original pattern of operations in a graph of computational operations on tensors, wherein the original pattern of operations returns a final output tensor and takes as input an input tensor;
transforming the original pattern of operations to a new pattern of operations, wherein the original pattern of operations is a pattern comprising reduce (reshape (input tensor)) in which one or more dimensions of the input tensor are reduced but are not changed by the reshape (input tensor) operation, and the new pattern of operations is a pattern comprising
reduce (reshape (reduce (input tensor) in which the reshape (reduce (input tensor)) operation of the new pattern returns a tensor that is smaller than a tensor returned by the reshape (input tensor) operation of the original pattern; and
generating executable code for a target hardware platform having a vector memory that aligns vectors on a vector boundary to facilitate execution of vector-based instructions, wherein the executable code implements computations represented by the new pattern of operations rather than the original pattern of operations, thereby reducing a number of vectors that require alignment on the vector boundary as a result of executing the reshape (reduce (input tensor)) operation in the new pattern of operations rather than the reshape (input tensor) operation of the original pattern of operations.
|