summaryrefslogtreecommitdiff
path: root/src/caffe/layers/deconv_layer.cu
diff options
context:
space:
mode:
Diffstat (limited to 'src/caffe/layers/deconv_layer.cu')
-rw-r--r--src/caffe/layers/deconv_layer.cu16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/caffe/layers/deconv_layer.cu b/src/caffe/layers/deconv_layer.cu
index 8a1eed8a..ea83f56f 100644
--- a/src/caffe/layers/deconv_layer.cu
+++ b/src/caffe/layers/deconv_layer.cu
@@ -16,11 +16,11 @@ void DeconvolutionLayer<Dtype>::Forward_gpu(const vector<Blob<Dtype>*>& bottom,
const Dtype* bottom_data = bottom[i]->gpu_data();
Dtype* top_data = top[i]->mutable_gpu_data();
for (int n = 0; n < this->num_; ++n) {
- this->backward_gpu_gemm(bottom_data + bottom[i]->offset(n), weight,
- top_data + top[i]->offset(n));
+ this->backward_gpu_gemm(bottom_data + n * this->bottom_dim_, weight,
+ top_data + n * this->top_dim_);
if (this->bias_term_) {
const Dtype* bias = this->blobs_[1]->gpu_data();
- this->forward_gpu_bias(top_data + top[i]->offset(n), bias);
+ this->forward_gpu_bias(top_data + n * this->top_dim_, bias);
}
}
}
@@ -39,20 +39,20 @@ void DeconvolutionLayer<Dtype>::Backward_gpu(const vector<Blob<Dtype>*>& top,
if (this->bias_term_ && this->param_propagate_down_[1]) {
Dtype* bias_diff = this->blobs_[1]->mutable_gpu_diff();
for (int n = 0; n < this->num_; ++n) {
- this->backward_gpu_bias(bias_diff, top_diff + top[i]->offset(n));
+ this->backward_gpu_bias(bias_diff, top_diff + n * this->top_dim_);
}
}
if (this->param_propagate_down_[0] || propagate_down[i]) {
for (int n = 0; n < this->num_; ++n) {
// gradient w.r.t. weight. Note that we will accumulate diffs.
if (this->param_propagate_down_[0]) {
- this->weight_gpu_gemm(top_diff + top[i]->offset(n),
- bottom_data + bottom[i]->offset(n), weight_diff);
+ this->weight_gpu_gemm(top_diff + n * this->top_dim_,
+ bottom_data + n * this->bottom_dim_, weight_diff);
}
// gradient w.r.t. bottom data, if necessary.
if (propagate_down[i]) {
- this->forward_gpu_gemm(top_diff + top[i]->offset(n), weight,
- bottom_diff + bottom[i]->offset(n),
+ this->forward_gpu_gemm(top_diff + this->top_dim_, weight,
+ bottom_diff + n * this->bottom_dim_,
this->param_propagate_down_[0]);
}
}