From 57e9ccbdf2f13cd66edd326a9cbf64c9207ab440 Mon Sep 17 00:00:00 2001 From: ahn <34005957+glingi@users.noreply.github.com> Date: Tue, 27 Aug 2019 09:37:44 +0900 Subject: [PATCH] Fix for more than one operator "*" Dev. Environment : Win10, CUDA v9.0, torch7, MSVC 19.00.24215.1 (VS 2015) x64 compiler Line 71, 86 and 101 caused "error : more than one operator "*" matches these operands" --- lib/THCUNN/PReLU.cu | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/THCUNN/PReLU.cu b/lib/THCUNN/PReLU.cu index 395e4a1e..0a286b76 100644 --- a/lib/THCUNN/PReLU.cu +++ b/lib/THCUNN/PReLU.cu @@ -68,7 +68,7 @@ struct PReLUAccGradParametersShared { __device__ __forceinline__ void operator()(T *gradInput, T *input, T *gradOutput) { - *gradInput = (*input) * (*gradOutput) * (*input <= 0); + *gradInput = *input <= 0 ? (*input) * (*gradOutput) : 0; } }; @@ -83,7 +83,7 @@ struct PReLUAccGradParameters __device__ __forceinline__ void operator()(T *gradInput, T *input, T *gradOutput) { - *gradInput = (*input) * (*gradOutput) * scale * (*input <= 0); + *gradInput = *input <= 0 ? (*input) * (*gradOutput) * scale : 0; } }; @@ -98,7 +98,7 @@ struct PReLUAccGradParameters1to1 __device__ __forceinline__ void operator()(T *gradWeight, T *input, T *gradOutput) { - *gradWeight += (*input) * (*gradOutput) * scale * (*input <= 0); + *gradWeight += *input <= 0 ? (*input) * (*gradOutput) * scale : 0; } };