Skip to content

Commit

Permalink
replaced 0.6- with 0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
denizyuret committed Sep 9, 2017
1 parent 4ef9782 commit 2a2cba3
Show file tree
Hide file tree
Showing 19 changed files with 31 additions and 31 deletions.
6 changes: 3 additions & 3 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ try success(`nvcc --version`)
catch
warn("Cannot find nvcc, GPU support will not be available.")
end
if haskey(ENV,"CI")
Pkg.checkout("AutoGrad")
end
# if haskey(ENV,"CI")
# Pkg.checkout("AutoGrad")
# end
cd("../src") do
run(`make`)
end
Expand Down
2 changes: 1 addition & 1 deletion examples/charlm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Example usage:
module CharLM
using Knet,AutoGrad,ArgParse,Compat,JLD

if VERSION >= v"0.6-"
if VERSION >= v"0.6.0"
sigm_dot(x)=sigm.(x)
tanh_dot(x)=tanh.(x)
else
Expand Down
2 changes: 1 addition & 1 deletion examples/housing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ using Knet,ArgParse

predict(w,x)=(w[1]*x.+w[2])

if VERSION >= v"0.6-"
if VERSION >= v"0.6.0"
loss(w,x,y)=(sum(abs2,y-predict(w,x)) / size(x,2))
else
loss(w,x,y)=(sumabs2(y-predict(w,x)) / size(x,2))
Expand Down
2 changes: 1 addition & 1 deletion examples/lenet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module LeNet
using Knet,ArgParse,Main
using MNIST: minibatch, accuracy

if VERSION >= v"0.6-"
if VERSION >= v"0.6.0"
relu_dot(x)=relu.(x)
else
relu_dot(x)=relu(x)
Expand Down
2 changes: 1 addition & 1 deletion examples/linreg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ using Knet, ArgParse

predict(w,x)=(w*x)

if VERSION >= v"0.6-"
if VERSION >= v"0.6.0"
loss(w,x,y)=(sum(abs2,y-predict(w,x)) / size(x,2))
else
loss(w,x,y)=(sumabs2(y-predict(w,x)) / size(x,2))
Expand Down
2 changes: 1 addition & 1 deletion examples/optimizers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function train(w, prms, data; epochs=10, iters=6000)
return w
end

if VERSION >= v"0.6-"
if VERSION >= v"0.6.0"
relu_dot(x)=relu.(x)
else
relu_dot(x)=relu(x)
Expand Down
2 changes: 1 addition & 1 deletion examples/vgg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ end

# convolutional network operations
convx(x,w) = conv4(w[1], x; padding=1, mode=1) .+ w[2]
if VERSION >= v"0.6-"
if VERSION >= v"0.6.0"
relux(x) = relu.(x)
else
relux(x) = relu(x)
Expand Down
8 changes: 4 additions & 4 deletions src/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function broadcast_op(f, j=f, o...)
# each kernel name ends with dimension count of result array
fname=Expr(:tuple,string($F16,"_",ndims(z)),:libknet8)
types=Expr(:tuple,Ptr{$T},Ptr{$T},Ptr{$T},ntuple(i->Cint,ndims(z)*3+1)...)
if VERSION >= v"0.6-"
if VERSION >= v"0.6.0"
expr=Expr(:call,:ccall,fname,Void,types,x,y,z,stride_x..., stride_y..., stride_z..., length(z))
else
expr=Expr(:ccall,fname,Void,types,x,y,z,stride_x..., stride_y..., stride_z..., length(z))
Expand Down Expand Up @@ -271,7 +271,7 @@ import Base: +, -, *, /, \
# tkelman: These two methods aren't necessary, and overwrite Base. You can get this behavior via max.(a,b), with @compat needed on 0.4.

# Ambiguity fixes:
if VERSION < v"0.6-"; @eval begin
if VERSION < v"0.6.0"; @eval begin
max{T<:Real,S<:Real}(a::KnetArray{T},s::S)=max(T(s),a)
max{T<:Real,S<:Real}(s::S,a::KnetArray{T})=max(T(s),a)
min{T<:Real,S<:Real}(a::KnetArray{T},s::S)=min(T(s),a)
Expand All @@ -291,7 +291,7 @@ import Base: broadcast

# Scalar kernels are defined for scalar,array order only.
# For array,scalar we can get most for free.
if VERSION < v"0.6-"; @eval begin
if VERSION < v"0.6.0"; @eval begin
(.+){T}(a::KnetArray{T},s::Number)=(.+)(T(s),a)
(.+){T}(s::Number,a::KnetArray{T})=(.+)(T(s),a)
(.-){T}(a::KnetArray{T},s::Number)=(.+)(T(-s),a)
Expand Down Expand Up @@ -326,7 +326,7 @@ end; else; @eval begin
$(broadcast_func(^)){T}(a::KnetArray{T},s::Number)=rpow.(T(s),a)
end; end

if VERSION < v"0.6-"; @eval begin
if VERSION < v"0.6.0"; @eval begin
.=={T}(a::KnetArray{T},s::Number)=(T(s).==a)
.=={T}(s::Number,a::KnetArray{T})=(T(s).==a)
.!={T}(a::KnetArray{T},s::Number)=(T(s).!=a)
Expand Down
4 changes: 2 additions & 2 deletions src/compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# const A{T} = B{T} only works after 0.6.
# This does the right thing without causing warnings
macro typealias6(t1,t2)
if VERSION >= v"0.6-"
if VERSION >= v"0.6.0"
esc(:(const $t1 = $t2))
else
Expr(:typealias, t1, t2)
Expand All @@ -13,7 +13,7 @@ end

using AutoGrad: exp_dot, log_dot, sqrt_dot, abs_dot, abs2_dot, sign_dot, tanh_dot

if VERSION >= v"0.6-"
if VERSION >= v"0.6.0"
@eval relu_dot(x) = relu.(x)
@eval sigm_dot(x) = sigm.(x)
else
Expand Down
6 changes: 3 additions & 3 deletions src/gpu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ macro gpu(_ex); if gpu()>=0; esc(_ex); end; end

macro cuda(lib,fun,x...) # give an error if library missing, or if error code!=0
if Libdl.find_library(["lib$lib"], []) != ""
if VERSION >= v"0.6-"
if VERSION >= v"0.6.0"
fx = Expr(:call, :ccall, ("$fun","lib$lib"), :UInt32, x...)
else
fx = Expr(:ccall, ("$fun","lib$lib"), :UInt32, x...)
Expand All @@ -18,7 +18,7 @@ end

macro cuda1(lib,fun,x...) # return -1 if library missing, error code if run
if Libdl.find_library(["lib$lib"], []) != ""
if VERSION >= v"0.6-"
if VERSION >= v"0.6.0"
fx = Expr(:call, :ccall, ("$fun","lib$lib"), :UInt32, x...)
else
fx = Expr(:ccall, ("$fun","lib$lib"), :UInt32, x...)
Expand All @@ -32,7 +32,7 @@ end

macro knet8(fun,x...) # error if libknet8 missing, nothing if run
if libknet8 != ""
if VERSION >= v"0.6-"
if VERSION >= v"0.6.0"
fx = Expr(:call, :ccall, ("$fun",libknet8), :Void, x...)
else
fx = Expr(:ccall, ("$fun",libknet8), :Void, x...)
Expand Down
2 changes: 1 addition & 1 deletion src/karray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ end
# function _getindex(l::LinearIndexing, A::AbstractArray, I::Union{Real, AbstractArray, Colon}...)
# in abstractarray.jl:487,multidimensional.jl:184.

if VERSION < v"0.5-"
if VERSION < v"0.5.0"
@typealias6 AbstractUnitRange UnitRange
end

Expand Down
2 changes: 1 addition & 1 deletion src/linalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ end

using Base.LinAlg
using Base.LinAlg.BLAS: libblas, BlasInt
if VERSION >= v"0.5-"
if VERSION >= v"0.5.0"
using Base.LinAlg.BLAS: @blasfunc
else
using Compat: @blasfunc
Expand Down
6 changes: 3 additions & 3 deletions src/reduction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# The entry format is (cudaname, julianame, merge, item, init)
# ai is the accumulator, xi is the array element
if VERSION >= v"0.6-"
if VERSION >= v"0.6.0"
import AutoGrad: sumabs_, sumabs2_, minabs_, maxabs_
Base.sum(::typeof(abs), x::KnetArray, d...) = sumabs_(x,d...);
Base.sum(::typeof(abs2), x::KnetArray, d...) = sumabs2_(x,d...);
Expand All @@ -20,7 +20,7 @@ if VERSION >= v"0.6-"
("minabs","minabs_","(ai<xi?ai:xi)","(xi<0?-xi:xi)","INFINITY"),
("countnz","countnz","ai+xi","(xi!=0)","0"),
]
else # if VERSION < v"0.6-"
else # if VERSION < v"0.6.0"
reduced_dims_compat(dims,region)=Base.reduced_dims(dims,region)
reduction_ops = [
("sum","sum","ai+xi","xi","0"),
Expand Down Expand Up @@ -108,7 +108,7 @@ import Base.LinAlg: norm, vecnorm

norm(x::KnetVector, p::Real=2) = vecnorm(x, p)

if VERSION >= v"0.6-"
if VERSION >= v"0.6.0"
function vecnorm{T}(x::KnetArray{T}, p::Real=2)
if length(x) == 0
zero(T)
Expand Down
2 changes: 1 addition & 1 deletion src/unary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ end

# Unary plus and minus
import Base: +, .+, -, .-, broadcast
if VERSION >= v"0.6-"
if VERSION >= v"0.6.0"
broadcast(::typeof(+), a::KnetArray)=a
+(a::KnetArray)=a
-(a::KnetArray)=broadcast(-,a)
Expand Down
4 changes: 2 additions & 2 deletions src/unfuse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
import Base: broadcast
using AutoGrad: Broadcasted # , broadcast_func

if VERSION >= v"0.6-"; @eval begin
if VERSION >= v"0.6.0"; @eval begin
broadcast(f, x::Union{Number,AbstractArray,Rec,KnetArray}...)=f(Broadcasted.(x)...).value
end; end

function broadcast_func(f)
if VERSION >= v"0.6-"
if VERSION >= v"0.6.0"
bf = Symbol("broadcast#", lstrip(string(f), '.'))
if isdefined(Knet, bf)
# ok
Expand Down
4 changes: 2 additions & 2 deletions test/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ broadcast_fns = Any[]
for f in Knet.broadcast_ops
if isa(f,Tuple); f=f[2]; end
in(f, exclude11) && continue
if VERSION >= v"0.6-"
if VERSION >= v"0.6.0"
f0 = eval(parse(lstrip(f,'.')))
f1 = x->broadcast(f0,x[1],x[2])
f2 = (x1,x2)->broadcast(f0,x1,x2)
Expand Down Expand Up @@ -83,7 +83,7 @@ srand(42)
@testset "array-array" begin
date("broadcast: array-array")
# for (f1,f) in broadcast_fns # takes too much time
if VERSION >= v"0.6-"
if VERSION >= v"0.6.0"
f = (x1,x2)->broadcast(+,x1,x2)
f1 = x->broadcast(+,x[1],x[2])
else
Expand Down
2 changes: 1 addition & 1 deletion test/karray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ if gpu() >= 0

@testset "cpu2gpu" begin
# cpu/gpu xfer with grad support
if VERSION >= v"0.6-"
if VERSION >= v"0.6.0"
@test gradcheck(x->Array(sin.(KnetArray(x))),a)
@test gradcheck(x->KnetArray(sin.(Array(x))),k)
else
Expand Down
2 changes: 1 addition & 1 deletion test/reduction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function rand21(f,t,d...)
elseif f==countnz || f==countnz2
t(0.01)+rand(t,d...)
elseif f==prod
if VERSION >= v"0.6-"
if VERSION >= v"0.6.0"
exp.(t(0.01)*randn(t,d...))
else
exp(t(0.01)*randn(t,d...))
Expand Down
2 changes: 1 addition & 1 deletion test/unary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function frand(f,t,d...)
end
end

if VERSION >= v"0.6-"
if VERSION >= v"0.6.0"
bcast(f)=(x->broadcast(f,x))
else
bcast(f)=f
Expand Down

0 comments on commit 2a2cba3

Please sign in to comment.