Skip to content

Commit d02f0a8

Browse files
committed
improve fill! performance.
1 parent 74ec5e6 commit d02f0a8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/knetarrays/abstractarray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ eltype(::Type{KnetArray{T}}) where {T} = T
1010
eltype(::Type{KnetArray{T,n}}) where {T,n} = T
1111
lastindex(a::KnetArray) = length(a)
1212
lastindex(a::KnetArray,d) = size(a,d)
13-
fill!(a::KnetArray{T},x) where {T}=(a[:] .= T(x);a)
13+
fill!(a::KnetArray{T},x) where {T}=setindex!(a,T(x),:)
1414
first(a::KnetArray) = a[1]
1515
# AutoGrad leaves `first` as a compound proc calling start which doesn't work with KnetArrays
1616
@primitive1 first(x::KnetArray),dy,y AutoGrad.ungetindex(x,dy,1)

0 commit comments

Comments
 (0)