Skip to content

Commit

Permalink
fix API changes in random
Browse files Browse the repository at this point in the history
  • Loading branch information
pluskid committed Sep 23, 2016
1 parent 623fbaf commit d718cfc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/random.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
function rand!(low::Real, high::Real, out::NDArray)
_random_uniform(low, high, out)
# XXX: note we reverse shape because julia and libmx has different dim order
_sample_uniform(NDArray, low=low, high=high, shape=reverse(size(out)), out=out)
end
function rand{N}(low::Real, high::Real, shape::NTuple{N, Int})
rand(low, high, shape, cpu())
Expand All @@ -10,7 +11,8 @@ function rand{N}(low::Real, high::Real, shape::NTuple{N, Int}, ctx::Context)
end

function randn!(mean::Real, stdvar::Real, out::NDArray)
_random_gaussian(mean, stdvar, out)
# XXX: note we reverse shape because julia and libmx has different dim order
_sample_normal(NDArray, loc=mean, scale=stdvar, shape=reverse(size(out)), out=out)
end
function randn{N}(mean::Real, stdvar::Real, shape::NTuple{N,Int})
randn(mean, stdvar, shape, cpu())
Expand Down

0 comments on commit d718cfc

Please sign in to comment.