Skip to content

Commit

Permalink
reshape(::AbstractZero) (#490)
Browse files Browse the repository at this point in the history
* reshape Zero

* tweak
  • Loading branch information
mcabbott authored Oct 12, 2021
1 parent e0ecaee commit d0c3599
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ChainRulesCore"
uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
version = "1.7.3"
version = "1.8.0"

[deps]
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
Expand Down
1 change: 1 addition & 0 deletions src/tangent_types/abstract_zero.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Base.getindex(z::AbstractZero, k) = z

Base.view(z::AbstractZero, ind...) = z
Base.sum(z::AbstractZero; dims=:) = z
Base.reshape(z::AbstractZero, size...) = z

"""
ZeroTangent() <: AbstractZero
Expand Down
3 changes: 3 additions & 0 deletions test/tangent_types/abstract_zero.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

@test sum(ZeroTangent()) == ZeroTangent()
@test sum(NoTangent(); dims=2) == NoTangent()

@test reshape(NoTangent(), (1, :)) === NoTangent()
@test reshape(ZeroTangent(), 2, 3, 4, 5) === ZeroTangent()
end

@testset "ZeroTangent" begin
Expand Down

2 comments on commit d0c3599

@mcabbott
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/46608

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.8.0 -m "<description of version>" d0c3599dd84c44baa8fba6ff96546d76fa84680f
git push origin v1.8.0

Please sign in to comment.