pullback drops cotangents when f repeats a variable or contains wrt, breaking pushforward
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
The bug is in pullback in pytensor/gradient.py, which keeps one cotangent per repeated variable and lets output cotangents override gradients from other outputs; pushforward in the same module depends on it. Start by running the reproduction snippets in the issue and checking which inputs explicit_graph_inputs returns. Done means all three pushforward cases return both tangents and the pullback cases return every cotangent, without breaking existing gradient tests.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
pytensor.gradient.pushforward drops tangents through Add and Sub, so the directional derivative of a + b depends on only one of the two tangents. The cause is pullback, which keeps only one cotangent per variable when f repeats a variable. It also lets the cotangent of a variable in f override the gradient reaching it through the other outputs. The default pushforward pulls back through a first pullback whose outputs for Add are the output cotangent itself, so it hits both cases.
import pytensor.tensor as pt
from pytensor.gradient import pullback, pushforward
from pytensor.graph.traversal import explicit_graph_inputs
x = pt.dscalar("x")
y_bar_1 = pt.dscalar("y_bar_1")
y_bar_2 = pt.dscalar("y_bar_2")
y = x**2
list(explicit_graph_inputs(pullback([y, y], x, [y_bar_1, y_bar_2]))) # [x, y_bar_2], expected [x, y_bar_1, y_bar_2]
list(explicit_graph_inputs(pullback([x, 2 * x], x, [y_bar_1, y_bar_2]))) # [y_bar_1], expected [y_bar_1, y_bar_2]
a = pt.dscalar("a")
b = pt.dscalar("b")
a_dot = pt.dscalar("a_dot")
b_dot = pt.dscalar("b_dot")
list(explicit_graph_inputs(pushforward(a + b, [a, b], [a_dot, b_dot]))) # [b_dot], expected [a_dot, b_dot]
list(explicit_graph_inputs(pushforward(a - b, [a, b], [a_dot, b_dot]))) # [a_dot], expected [a_dot, b_dot]
list(explicit_graph_inputs(pushforward(a + 2 * b, [a, b], [a_dot, b_dot]))) # [a_dot], expected [a_dot, b_dot]
This came up while computing sparse Jacobians from colored pushforwards for #2578.
- Ngôn ngữ chính
- Python
- Star
- 654
- Fork
- 258
- Merge trung bình
- 3 ngày 41 phút
- Pull request đã merge (30 ngày)
- 42
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của pymc-devs/pytensor
-
Docs of mode still mentions C/CVM as the default with FAST_RUNCó thể đã có người làm @ADITYASINGH1206 đã nhận 8 ngày trước. Đang mởdocs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
pymc-devs/pytensor#2641 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Update conditions page in docsĐang mởdocs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
BUG: geomspace returns wrong sign for the endpoints when start and stop are negativeCó thể đã có người làm @mayuriphad đã nhận 27 ngày trước. Đang mở
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Reciprocal.impl computes np.float32(1.0) / x: float32 precision for float64 scalars under NEP 50 (Python linker)Có thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
pymc-devs/pytensor#2430 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
pymc-devs/pytensor#2428 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của pymc-devs/pytensor
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
dgunning/edgartools#2019 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
topoteretes/cognee#6818 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
source_verification_agent: no outcome when the publisher confirms a work but its DOI resolves to a different recordCó thể đã có người làm @pinjun99 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Imbad0202/academic-research-skills#1159 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: DoubleMLData.from_arrays checks the treatment d with force_all_x_finite instead of force_all_d_finiteCó thể đã có người làm @leninworld đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
DoubleML/doubleml-for-py#471 ·
Maintainer thường phản hồi trong vòng 1 ngày