зеркало из https://github.com/microsoft/caffe.git
fix casts (static for void*)
This commit is contained in:
Родитель
6461365565
Коммит
19e909ba98
|
@ -75,25 +75,25 @@ const Dtype* Blob<Dtype>::gpu_diff() const {
|
|||
template <typename Dtype>
|
||||
Dtype* Blob<Dtype>::mutable_cpu_data() {
|
||||
CHECK(data_);
|
||||
return reinterpret_cast<Dtype*>(data_->mutable_cpu_data());
|
||||
return static_cast<Dtype*>(data_->mutable_cpu_data());
|
||||
}
|
||||
|
||||
template <typename Dtype>
|
||||
Dtype* Blob<Dtype>::mutable_gpu_data() {
|
||||
CHECK(data_);
|
||||
return reinterpret_cast<Dtype*>(data_->mutable_gpu_data());
|
||||
return static_cast<Dtype*>(data_->mutable_gpu_data());
|
||||
}
|
||||
|
||||
template <typename Dtype>
|
||||
Dtype* Blob<Dtype>::mutable_cpu_diff() {
|
||||
CHECK(diff_);
|
||||
return reinterpret_cast<Dtype*>(diff_->mutable_cpu_data());
|
||||
return static_cast<Dtype*>(diff_->mutable_cpu_data());
|
||||
}
|
||||
|
||||
template <typename Dtype>
|
||||
Dtype* Blob<Dtype>::mutable_gpu_diff() {
|
||||
CHECK(diff_);
|
||||
return reinterpret_cast<Dtype*>(diff_->mutable_gpu_data());
|
||||
return static_cast<Dtype*>(diff_->mutable_gpu_data());
|
||||
}
|
||||
|
||||
template <typename Dtype>
|
||||
|
@ -121,15 +121,15 @@ void Blob<Dtype>::Update() {
|
|||
case SyncedMemory::HEAD_AT_CPU:
|
||||
// perform computation on CPU
|
||||
caffe_axpy<Dtype>(count_, Dtype(-1),
|
||||
reinterpret_cast<const Dtype*>(diff_->cpu_data()),
|
||||
reinterpret_cast<Dtype*>(data_->mutable_cpu_data()));
|
||||
static_cast<const Dtype*>(diff_->cpu_data()),
|
||||
static_cast<Dtype*>(data_->mutable_cpu_data()));
|
||||
break;
|
||||
case SyncedMemory::HEAD_AT_GPU:
|
||||
case SyncedMemory::SYNCED:
|
||||
// perform computation on GPU
|
||||
caffe_gpu_axpy<Dtype>(count_, Dtype(-1),
|
||||
reinterpret_cast<const Dtype*>(diff_->gpu_data()),
|
||||
reinterpret_cast<Dtype*>(data_->mutable_gpu_data()));
|
||||
static_cast<const Dtype*>(diff_->gpu_data()),
|
||||
static_cast<Dtype*>(data_->mutable_gpu_data()));
|
||||
break;
|
||||
default:
|
||||
LOG(FATAL) << "Syncedmem not initialized.";
|
||||
|
@ -150,19 +150,19 @@ void Blob<Dtype>::CopyFrom(const Blob& source, bool copy_diff, bool reshape) {
|
|||
case Caffe::GPU:
|
||||
if (copy_diff) {
|
||||
caffe_copy(count_, source.gpu_diff(),
|
||||
reinterpret_cast<Dtype*>(diff_->mutable_gpu_data()));
|
||||
static_cast<Dtype*>(diff_->mutable_gpu_data()));
|
||||
} else {
|
||||
caffe_copy(count_, source.gpu_data(),
|
||||
reinterpret_cast<Dtype*>(data_->mutable_gpu_data()));
|
||||
static_cast<Dtype*>(data_->mutable_gpu_data()));
|
||||
}
|
||||
break;
|
||||
case Caffe::CPU:
|
||||
if (copy_diff) {
|
||||
caffe_copy(count_, source.cpu_diff(),
|
||||
reinterpret_cast<Dtype*>(diff_->mutable_cpu_data()));
|
||||
static_cast<Dtype*>(diff_->mutable_cpu_data()));
|
||||
} else {
|
||||
caffe_copy(count_, source.cpu_data(),
|
||||
reinterpret_cast<Dtype*>(data_->mutable_cpu_data()));
|
||||
static_cast<Dtype*>(data_->mutable_cpu_data()));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
Загрузка…
Ссылка в новой задаче