denizyuret / AutoGrad.jl

Julia port of the Python autograd package.
Other
169 stars 26 forks source link

Support `getproperty` and fix `svd` #109

Closed ylxdzsw closed 2 years ago

ylxdzsw commented 5 years ago

As Julia allows overloading getproperty and setproperty! now, we should also support the new usage. I extended the getindex to getelement and supports both getindex and getproperty.

A problem is that since we defined getproperty(::Value, ::Symbol), we can no longer use a.b in our code when working with Values. I have replaced all of them with either getfield or special field-accessing functions.

As a bonus, svd now works using getproperty instead of iterate. qr and lq should also work but they are broken probably because Julia has changed the related API and our code did not updated. However as a bad student I don't have the linear algebra knowledge to understand and fix them so I leaved them as @test_broken.

codecov[bot] commented 5 years ago

Codecov Report

Merging #109 into master will increase coverage by 3.96%. The diff coverage is 62.5%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #109      +/-   ##
==========================================
+ Coverage   67.07%   71.03%   +3.96%     
==========================================
  Files          13       13              
  Lines         568      587      +19     
==========================================
+ Hits          381      417      +36     
+ Misses        187      170      -17
Impacted Files Coverage Δ
src/AutoGrad.jl 66.66% <ø> (ø) :arrow_up:
src/base.jl 100% <ø> (ø) :arrow_up:
src/show.jl 10.71% <0%> (ø) :arrow_up:
src/linearalgebra.jl 68.33% <100%> (+42.47%) :arrow_up:
src/getelement.jl 57.14% <40%> (ø)
src/sum_outgrads.jl 43.75% <76.92%> (+2.44%) :arrow_up:
src/core.jl 88.69% <81.81%> (+0.09%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c80fa9c...37abb0d. Read the comment docs.