#ifndef CAFFE_COMMON_HPP_
#define CAFFE_COMMON_HPP_
#include
#include
#include
#include
#include
#include // NOLINT(readability/streams)
#include // NOLINT(readability/streams)
#include
#include
#include
#include
#include // pair
#include
#include "caffe/util/device_alternate.hpp"
// Convert macro to string
#define STRINGIFY(m) #m
#define AS_STRING(m) STRINGIFY(m)
// gflags 2.1 issue: namespace google was changed to gflags without warning.
// Luckily we will be able to use GFLAGS_GFLAGS_H_ to detect if it is version
// 2.1. If yes, we will add a temporary solution to redirect the namespace.
// TODO(Yangqing): Once gflags solves the problem in a more elegant way, let's
// remove the following hack.
#ifndef GFLAGS_GFLAGS_H_
namespace gflags = google;
#endif // GFLAGS_GFLAGS_H_
// Disable the copy and assignment operator for a class.
#define DISABLE_COPY_AND_ASSIGN(classname) \
private:\
classname(const classname&);\
classname& operator=(const classname&)
// Instantiate a class with float and double specifications.
#define INSTANTIATE_CLASS(classname) \
char gInstantiationGuard##classname; \
template class classname; \
template class classname
#define INSTANTIATE_LAYER_GPU_FORWARD(classname) \
template void classname::Forward_gpu( \
const std::vector& bottom, \
const std::vector& top); \
template void classname::Forward_gpu( \
const std::vector& bottom, \
const std::vector& top);
#define INSTANTIATE_LAYER_GPU_BACKWARD(classname) \
template void classname::Backward_gpu( \
const std::vector& top, \
const std::vector& propagate_down, \
const std::vector& bottom); \
template void classname::Backward_gpu( \
const std::vector& top, \
const std::vector& propagate_down, \
const std::vector& bottom)
#define INSTANTIATE_LAYER_GPU_FUNCS(classname) \
INSTANTIATE_LAYER_GPU_FORWARD(classname); \
INSTANTIATE_LAYER_GPU_BACKWARD(classname)
// A simple macro to mark codes that are not implemented, so that when the code
// is executed we will see a fatal log.
#define NOT_IMPLEMENTED LOG(FATAL)