Skip to content

Commit

Permalink
Clean-up some methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Oct 29, 2020
1 parent c70bb39 commit 5e70e0d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions lib/cudnn/activation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,19 @@ end

function cudnnActivationForward(x::DenseCuArray{T,N}, y::DenseCuArray{T,N}=x;
mode=CUDNN_ACTIVATION_RELU, # CUDNN_ACTIVATION_IDENTITY will not work
coeff=0.0, reluNanOpt=CUDNN_NOT_PROPAGATE_NAN, alpha=1, beta=0) where {T,N}
coeff=false, reluNanOpt=CUDNN_NOT_PROPAGATE_NAN, alpha=true,
beta=false) where {T,N}
cudnnActivationForward(handle(), ActivationDesc(mode, T(coeff), reluNanOpt),
scalingParameter(T, alpha), TensorDesc(x), x,
scalingParameter(T, beta ), TensorDesc(y), y)
return y
end

function cudnnActivationBackward(x::DenseCuArray{T,N}, dx::DenseCuArray{T,N}, y::DenseCuArray{T,N}, dy::DenseCuArray{T,N}=dx;
function cudnnActivationBackward(x::DenseCuArray{T,N}, dx::DenseCuArray{T,N},
y::DenseCuArray{T,N}, dy::DenseCuArray{T,N}=dx;
mode=CUDNN_ACTIVATION_RELU, # CUDNN_ACTIVATION_IDENTITY will not work
coeff=0.0, reluNanOpt=CUDNN_NOT_PROPAGATE_NAN, alpha=1, beta=0) where {T,N}
coeff=false, reluNanOpt=CUDNN_NOT_PROPAGATE_NAN, alpha=1,
beta=false) where {T,N}
cudnnActivationBackward(handle(), ActivationDesc(mode, T(coeff), reluNanOpt),
scalingParameter(T, alpha), TensorDesc( y), y,
TensorDesc(dy), dy,
Expand Down
4 changes: 2 additions & 2 deletions lib/cudnn/tensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ OpTensorDesc(op::cudnnOpTensorOp_t, a::DenseCuArray) = OpTensorDesc(op, eltype(a

function cudnnOpTensor(op::cudnnOpTensorOp_t,
A::DenseCuArray{T,N}, B::DenseCuArray{T,N}, C::DenseCuArray{T,N};
alpha1=1, alpha2=1, beta=0) where {T,N}
alpha1=true, alpha2=true, beta=false) where {T,N}
cudnnOpTensor(handle(), OpTensorDesc(op, T),
scalingParameter(T, alpha1), TensorDesc(A), A,
scalingParameter(T, alpha2), TensorDesc(B), B,
Expand Down Expand Up @@ -113,7 +113,7 @@ end

function cudnnReduceTensor(op::cudnnReduceTensorOp_t,
A::DenseCuArray{T,N}, C::DenseCuArray{T,N};
alpha=1, beta=0) where {T,N}
alpha=true, beta=false) where {T,N}
# indices = Array{UInt64, 1}(undef, N)
indicesSizeInBytes = cudnnGetReductionIndicesSize(op, A, C)
@workspace size=@argout(
Expand Down

0 comments on commit 5e70e0d

Please sign in to comment.