Skip to content

Different-typed forward grad#2574

Merged
wsmoses merged 2 commits intomainfrom
dty
Sep 14, 2025
Merged

Different-typed forward grad#2574
wsmoses merged 2 commits intomainfrom
dty

Conversation

@wsmoses
Copy link
Member

@wsmoses wsmoses commented Sep 14, 2025

No description provided.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 14, 2025

Your PR requires formatting changes to meet the project's style guidelines.
Please consider running Runic (git runic main) to apply these changes.

Click here to view the suggested changes.
diff --git a/src/sugar.jl b/src/sugar.jl
index 385266e..50dc3e6 100644
--- a/src/sugar.jl
+++ b/src/sugar.jl
@@ -168,7 +168,7 @@ end
 @inline function onehot(x::NTuple{N,T}) where {T,N}
     onehot(NTuple{N,T})
 end
-@inline function onehot(x::NTuple{N,T}, start::Int, endl::Int) where {T,N}
+@inline function onehot(x::NTuple{N, T}, start::Int, endl::Int) where {T, N}
     ntuple(Val(endl - start + 1)) do i
         Base.@_inline_meta
         ntuple(Val(N)) do idx
@@ -183,7 +183,7 @@ end
 end
 
 @inline function onehot(x::Tuple{Vararg{<:AbstractFloat}})
-    ntuple(Val(length(x))) do i
+    return ntuple(Val(length(x))) do i
         Base.@_inline_meta
         ntuple(Val(length(x))) do idx
             Base.@_inline_meta
diff --git a/test/sugar.jl b/test/sugar.jl
index 3e13324..b6863fd 100644
--- a/test/sugar.jl
+++ b/test/sugar.jl
@@ -191,7 +191,7 @@ end
 
 end
 
-tupsq(t) = t[1]*t[2]
+tupsq(t) = t[1] * t[2]
 
 @testset "Forward differing element tuple of floats" begin
     res = Enzyme.gradient(Enzyme.Forward, tupsq, (3.0, Float32(2.0)))[1]

@github-actions
Copy link
Contributor

github-actions bot commented Sep 14, 2025

Benchmark Results

main d184aaa... main / d184aaa...
basics/overhead 4.65 ± 0.01 ns 4.65 ± 0.01 ns 1 ± 0.003
time_to_load 1.3 ± 0.0097 s 1.31 ± 0.015 s 0.993 ± 0.013

Benchmark Plots

A plot of the benchmark results has been uploaded as an artifact at https://github.com/EnzymeAD/Enzyme.jl/actions/runs/17704863192/artifacts/4004709433.

@codecov
Copy link

codecov bot commented Sep 14, 2025

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 75.01%. Comparing base (3b76eb6) to head (d184aaa).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/sugar.jl 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2574      +/-   ##
==========================================
- Coverage   75.01%   75.01%   -0.01%     
==========================================
  Files          56       56              
  Lines       17703    17710       +7     
==========================================
+ Hits        13280    13285       +5     
- Misses       4423     4425       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wsmoses wsmoses merged commit 15e1a93 into main Sep 14, 2025
37 of 42 checks passed
@wsmoses wsmoses deleted the dty branch September 14, 2025 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant