Skip to content

Commit

Permalink
Add sameGPU checks to BatchNormalization (#361)
Browse files Browse the repository at this point in the history
  • Loading branch information
colesbury authored and soumith committed Oct 25, 2016
1 parent b612429 commit 64224a6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/THCUNN/BatchNormalization.cu
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "THCUNN.h"
#include "common.h"

#include "THCDeviceTensor.cuh"
#include "THCDeviceTensorUtils.cuh"
Expand Down Expand Up @@ -233,6 +234,8 @@ void THNN_CudaBatchNormalization_updateOutput(
THCudaTensor *runningVar_, THCudaTensor *saveMean_, THCudaTensor *saveStd_,
bool train, double momentum, double eps) {

THCUNN_assertSameGPU(state, 8, input_, output_, weight_, bias_, runningMean_,
runningVar_, saveMean_, saveStd_);
DeviceTensor3 input = devicetensor<3>(state, input_);
DeviceTensor3 output = devicetensor<3>(state, output_);
DeviceTensor1 weight = devicetensor<1>(state, weight_);
Expand Down Expand Up @@ -335,6 +338,8 @@ void THNN_CudaBatchNormalization_backward(
THCudaTensor *weight_, THCudaTensor *runningMean_, THCudaTensor *runningVar_,
THCudaTensor *saveMean_, THCudaTensor *saveStd_, bool train, float scale, double eps) {

THCUNN_assertSameGPU(state, 10, input_, gradOutput_, gradInput_, gradWeight_,
gradBias_, weight_, runningMean_, runningVar_, saveMean_, saveStd_);
DeviceTensor3 input = devicetensor<3>(state, input_);
DeviceTensor3 gradOutput = devicetensor<3>(state, gradOutput_);
DeviceTensor3 gradInput = devicetensor<3>(state, gradInput_);
Expand Down

0 comments on commit 64224a6

Please sign in to comment.