Skip to content

Commit

Permalink
Don't extend base functions on base types
Browse files Browse the repository at this point in the history
  • Loading branch information
tkelman committed May 2, 2017
1 parent 7eea918 commit 818ccf1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const AArray = AbstractArray
initn(dims...) = randn(dims...)/100

unsqueeze(xs, dim = 1) = reshape(xs, (size(xs)[1:dim-1]..., 1, size(xs)[dim:end]...))
Base.squeeze(xs) = squeeze(xs, 1)

stack(xs, dim = 1) = cat(dim, unsqueeze.(xs, dim)...)
unstack(xs, dim = 1) = [slicedim(xs, dim, i) for i = 1:size(xs, dim)]
Expand Down
2 changes: 1 addition & 1 deletion test/recurrent.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ end
_, ys = apply(unroll1(r).model, xs, (r.y.x,))
@test ys[1] == tanh(xs[1] * r.Wxy.x .+ r.y.x * r.Wyy.x .+ r.by.x)
ru = unroll(r, 3)
ru(batchone(Seq(squeeze.(xs))))[1] == squeeze.(ys)
ru(batchone(Seq((x->squeeze(x,1)).(xs))))[1] == (x->squeeze(x,1)).(ys)
end

0 comments on commit 818ccf1

Please sign in to comment.