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

Simplify matrix/tensor operations performed on scalars #1179

Open
brandonwillard opened this issue Sep 13, 2022 · 0 comments
Open

Simplify matrix/tensor operations performed on scalars #1179

brandonwillard opened this issue Sep 13, 2022 · 0 comments
Labels
graph rewriting help wanted Extra attention is needed shape inference tensor algebra Relates to our use and representations of tensor algebra

Comments

@brandonwillard
Copy link
Member

Ops like Solve and Det can be simplified/removed when their inputs are known to be scalars.

For example, the following graphs could be simplified but currently aren't:

import aesara
import aesara.tensor as at


A = at.tensor("floatX", name="A", shape=(1, 1))
b = at.tensor("floatX", name="b", shape=(1,))

z = at.slinalg.solve(A, b)
w = at.nlinalg.det(A)

z_w_fn = aesara.function([A, b], [z, w])

aesara.dprint(z_w_fn, print_type=True)
# Solve{assume_a='gen', lower=False, check_finite=True} [id A] <TensorType(float64, (1,))> 0
#  |A [id B] <TensorType(float64, (1, 1))>
#  |b [id C] <TensorType(float64, (1,))>
# Det [id D] <TensorType(float64, ())> 1
#  |A [id B] <TensorType(float64, (1, 1))>
@brandonwillard brandonwillard added help wanted Extra attention is needed graph rewriting shape inference tensor algebra Relates to our use and representations of tensor algebra labels Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
graph rewriting help wanted Extra attention is needed shape inference tensor algebra Relates to our use and representations of tensor algebra
Projects
None yet
Development

No branches or pull requests

1 participant