Commit f72126c1 authored by A. Unique TensorFlower's avatar A. Unique TensorFlower Committed by TensorFlower Gardener
Browse files

Two improvements in resolve_tensorflow_matmul:

1. Before inserting a new Transpose node, check if there already is one that
   may be reused. In practice, there are two cases: either the array being
   transposed is a constant (by far the most common case) or it's not.
    * If it is constant, then this doesn't really make a difference:
      ResolveConstantTranspose runs anyway, eliminating these Transpose nodes
      and also mootifying this change as it leaves no Transpose node to be
      reused. So in that case, constant-array-deduping is really the only
      thing that prevents duplication of data.
    * If it is not constant, that's where this new logic really helps, as
      the resulting Transpose nodes are here to stay in the final graph,
      and this avoids inserting more than are needed.
2. transpose_a is not supported. However, rather than CHECK-fail, it's more
   useful to have this graph transformation bail with a log message. The
   resulting 'unresolved' MatMul node could still be handled in some way
   at the TFLite level, or we could end up having support for MatMul per se.

PiperOrigin-RevId: 213678294
parent c9535349
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment