Change gate
function to view
instead of copy
Only for vector input as copying a matrix may be more efficient due to caching. A matrix is sliced per row, meaning the view will not be aligned.
This commit is contained in:
parent
645aa04464
commit
7b41bc4ab5
@ -1,5 +1,5 @@
|
||||
gate(h, n) = (1:h) .+ h*(n-1)
|
||||
gate(x::AbstractVector, h, n) = x[gate(h,n)]
|
||||
gate(x::AbstractVector, h, n) = @view x[gate(h,n)]
|
||||
gate(x::AbstractMatrix, h, n) = x[gate(h,n),:]
|
||||
|
||||
# Stateful recurrence
|
||||
|
Loading…
Reference in New Issue
Block a user