Apollo 10.0
自动驾驶开放平台
test_helper.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16#pragma once
17
18#define CUDA_TEST_DEVICE -1
19#define EXAMPLES_SOURCE_DIR "examples/"
20#define ABS_TEST_DATA_DIR "src/caffe/test/test_data"
21
22namespace apollo {
23namespace perception {
24namespace base {
25
26template <typename TypeParam>
27class MultiDeviceTest : public ::testing::Test {
28 public:
29 typedef typename TypeParam::Dtype Dtype;
30
31 protected:
33 // Caffe::set_mode(TypeParam::device);
34 }
35 virtual ~MultiDeviceTest() {}
36};
37
38typedef ::testing::Types<float, double> TestDtypes;
39
40template <typename TypeParam>
41struct CPUDevice {
42 typedef TypeParam Dtype;
43 // static const Caffe::Brew device = Caffe::CPU;
44};
45
46template <typename Dtype>
47class CPUDeviceTest : public MultiDeviceTest<CPUDevice<Dtype>> {};
48
49#if USE_GPU == 0
50
51typedef ::testing::Types<CPUDevice<float>, CPUDevice<double>>
53
54#else
55
56template <typename TypeParam>
57struct GPUDevice {
58 typedef TypeParam Dtype;
59 // static const Caffe::Brew device = Caffe::GPU;
60};
61
62template <typename Dtype>
63class GPUDeviceTest : public MultiDeviceTest<GPUDevice<Dtype>> {};
64
65typedef ::testing::Types<CPUDevice<float>, CPUDevice<double>, GPUDevice<float>,
66 GPUDevice<double>>
68
69#endif
70
71} // namespace base
72} // namespace perception
73} // namespace apollo
::testing::Types< float, double > TestDtypes
Definition test_helper.h:38
::testing::Types< CPUDevice< float >, CPUDevice< double > > TestDtypesAndDevices
Definition test_helper.h:52
class register implement
Definition arena_queue.h:37