Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dynamic shapes] Add some support for handling tracers as dimensions #9335

Closed
wants to merge 1 commit into from

Conversation

gnecula
Copy link
Collaborator

@gnecula gnecula commented Jan 26, 2022

The main goal here is to revert the changes to lax.py:_bradcasting_shape_rule
to use again _try_broadcast_shapes, and DimensionHandlers, so that the code
that deals with shapes in lax_numpy and the shaping rules is kept simple
and all details about handling dimension sizes that are non constant are
factored out in the DimensionHandler classes.

We do this by creating a DimensionHandler for the case when the dimension
size is a Tracer. (At the moment this works only for DynamicJaxprTracer; we
will need to relax this.)

In this PR the only conclusive operation on Tracer dimensions is that
two identical Tracers are deemed to represent equal dimensions.

@gnecula gnecula requested a review from mattjj January 26, 2022 10:20
@gnecula gnecula self-assigned this Jan 26, 2022
@gnecula gnecula added the pull ready Ready for copybara import and testing label Jan 26, 2022
@gnecula gnecula force-pushed the fix_new_poly branch 3 times, most recently from c4dcd40 to 49676fb Compare January 27, 2022 12:02
The main goal here is to revert the changes to lax.py:_bradcasting_shape_rule
to use again _try_broadcast_shapes, and DimensionHandlers, so that the code
that deals with shapes in lax_numpy and the shaping rules is kept simple
and all details about handling dimension sizes that are non constant are
factored out in the DimensionHandler classes.

We do this by creating a DimensionHandler for the case when the dimension
size is a Tracer. (At the moment this works only for DynamicJaxprTracer; we
will need to relax this.)

In this PR the only conclusive operation on Tracer dimensions is that
two identical Tracers are deemed to represent equal dimensions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pull ready Ready for copybara import and testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant