From 25538ce07d0e71e2ed1a523f50b8f9a40daeb424 Mon Sep 17 00:00:00 2001 From: Felix Abecassis Date: Tue, 26 May 2015 11:21:15 -0700 Subject: [PATCH] Refactor types FloatCPU and DoubleCPU into a new type CPUDevice Similarly, FloatGPU and DoubleGPU are replaced by a new type GPUDevice. --- include/caffe/test/test_caffe_main.hpp | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/include/caffe/test/test_caffe_main.hpp b/include/caffe/test/test_caffe_main.hpp index bd5f31e..89b4405 100644 --- a/include/caffe/test/test_caffe_main.hpp +++ b/include/caffe/test/test_caffe_main.hpp @@ -40,34 +40,28 @@ class MultiDeviceTest : public ::testing::Test { typedef ::testing::Types TestDtypes; -struct FloatCPU { - typedef float Dtype; - static const Caffe::Brew device = Caffe::CPU; -}; - -struct DoubleCPU { - typedef double Dtype; +template +struct CPUDevice { + typedef TypeParam Dtype; static const Caffe::Brew device = Caffe::CPU; }; #ifdef CPU_ONLY -typedef ::testing::Types TestDtypesAndDevices; +typedef ::testing::Types, + CPUDevice > TestDtypesAndDevices; #else -struct FloatGPU { - typedef float Dtype; - static const Caffe::Brew device = Caffe::GPU; -}; - -struct DoubleGPU { - typedef double Dtype; +template +struct GPUDevice { + typedef TypeParam Dtype; static const Caffe::Brew device = Caffe::GPU; }; -typedef ::testing::Types - TestDtypesAndDevices; +typedef ::testing::Types, CPUDevice, + GPUDevice, GPUDevice > + TestDtypesAndDevices; #endif -- 2.7.4