1. A method comprising: obtaining an un-optimized computational graph comprising a plurality of nodes representing operations and a plurality of directed edges representing data dependencies between the operations; analyzing the un-optimized computational graph using pattern matching to determine fusable operations that can be fused together, wherein each fusable operation of the fusable operations is decomposed into an index function and a data function; generating a single fusion operation using a composition of the index functions and the data functions for the fusable operations; transforming the un-optimized computational graph into an optimized computational graph, by replacing the plurality of nodes representing the fusable operations in the un-optimized computational graph with a single fusion node representing the single fusion operation; and providing, to a compiler, the optimized computational graph including the single fusion node that the compiler can translate as a call that performs the single fusion operation to produce efficient code at a code generation phase of compilation.