Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ndarray: implement rdiv#292

Merged
pluskid merged 4 commits into
dmlc:masterfrom
iblislin:nd-rdiv
Nov 6, 2017
Merged

ndarray: implement rdiv#292
pluskid merged 4 commits into
dmlc:masterfrom
iblislin:nd-rdiv

Conversation

@iblislin

@iblislin iblislin commented Oct 8, 2017

Copy link
Copy Markdown
Member

e.g.

1 ./ mx.NDArray(Float32[1 2; 3 4])

e.g.

```julia
1 ./ mx.NDArray(Float32[1 2; 3 4])
```
@codecov-io

codecov-io commented Oct 8, 2017

Copy link
Copy Markdown

Codecov Report

❗ No coverage uploaded for pull request base (master@4f182ee). Click here to learn what that means.
The diff coverage is 85.71%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #292   +/-   ##
=========================================
  Coverage          ?   69.52%           
=========================================
  Files             ?       25           
  Lines             ?     1913           
  Branches          ?        0           
=========================================
  Hits              ?     1330           
  Misses            ?      583           
  Partials          ?        0
Impacted Files Coverage Δ
src/ndarray.jl 84.24% <85.71%> (ø)

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 4f182ee...485b5f0. Read the comment docs.

Comment thread src/ndarray.jl

Elementwise Divide a scalar by an `NDArray`.
"""
/(arg0 :: Real, arg :: NDArray) = div(arg0, arg)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I am not a fan of this since it it no longer Julia semantics

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

hmm ... I misunderstood that julia 0.5 need it for broadcasting.
(maybe I should not write code in early morning :p

@iblislin iblislin Oct 10, 2017

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh... we still need it because of Julia 0.6's broadcasting fusion

julia> expand(:(1 ./ mx.zeros(4)))
:($(Expr(:thunk, CodeInfo(:(begin 
        $(Expr(:thunk, CodeInfo(:(begin 
        global ##5#6
        const ##5#6
        $(Expr(:composite_type, Symbol("##5#6"), :((Core.svec)()), :((Core.svec)()), :(Core.Function), :((Core.svec)()), false, 0))
        return
    end))))
        $(Expr(:method, false, :((Core.svec)((Core.svec)(##5#6, Core.Any), (Core.svec)())), CodeInfo(:(begin 
        return 1 / #temp#
    end)), false))
        #5 = $(Expr(:new, Symbol("##5#6")))
        SSAValue(0) = #5
        SSAValue(1) = ((Core.getfield)(mx, :zeros))(4)
        return (Base.broadcast)(SSAValue(0), SSAValue(1))
    end)))))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We need to solve #170. Before we can do this.

@iblislin iblislin mentioned this pull request Nov 1, 2017
5 tasks
@pluskid pluskid merged commit a3317f1 into dmlc:master Nov 6, 2017
@iblislin iblislin added this to the v0.3.0 milestone Nov 13, 2017
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.

4 participants