-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[jax2tf] Allows shape polymorphic specification to be polynomials.
Until now, the polymorphic_shapes parameters could contain only a constant or a dimension variable in each dimension. With this PR we allow polynomials. These are needed in two situations: * when converting the VJP of a shape polymorphic function the shape specification corresponding to the cotangent must match the shape of the output of the primal function, which may contain polynomials of dimension variables. * one can specify that a dimension is even-sized by writing it as "2 * b", or that it is at least 10, by writing "b + 9". This change requires changes to the code that solves the dimension variables in terms of `tf.shape(arg)`. The dimension variables are solved only from linear uni-variate polynomials followed by replacing the solved variables in the other polynomials and repeating until all variables are solved.
- Loading branch information
Showing
4 changed files
with
288 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.