forked from luoyetx/mini-caffe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor headers * fix build * optimize PReLU layer * optimize prelu * add python api * try to fix install numpy * fix * fix appveyor * optim prelu * fix type * update * add layer crafter * list network params * update README * fix py3 * add python3 test * fix travis
- Loading branch information
Showing
49 changed files
with
832 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#ifndef CAFFE_BASE_HPP_ | ||
#define CAFFE_BASE_HPP_ | ||
|
||
#include <string> | ||
#include <vector> | ||
#include <memory> | ||
|
||
#include <caffe/logging.hpp> | ||
|
||
#ifdef _MSC_VER | ||
#ifdef CAFFE_EXPORTS | ||
#define CAFFE_API __declspec(dllexport) | ||
#else | ||
#define CAFFE_API __declspec(dllimport) | ||
#endif | ||
#else | ||
#define CAFFE_API | ||
#endif | ||
|
||
#ifdef _MSC_VER | ||
#pragma warning(disable:4251) | ||
#endif | ||
|
||
// Convert macro to string | ||
#define STRINGIFY(m) #m | ||
#define AS_STRING(m) STRINGIFY(m) | ||
|
||
// Disable the copy and assignment operator for a class. | ||
#define DISABLE_COPY_AND_ASSIGN(classname) \ | ||
private: \ | ||
classname(const classname&) = delete; \ | ||
classname(classname&&) = delete; \ | ||
classname& operator=(const classname&) = delete; \ | ||
classname& operator=(classname&&) = delete | ||
|
||
// 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) << "Not Implemented Yet" | ||
#define NO_GPU LOG(FATAL) << "Cannot use GPU in CPU-only Caffe: check mode." | ||
|
||
#define STUB_GPU(classname) \ | ||
void classname::Forward_gpu(const vector<Blob*>& bottom, \ | ||
const vector<Blob*>& top) { NO_GPU; } | ||
|
||
#define STUB_GPU_FORWARD(classname, funcname) \ | ||
void classname::funcname##_##gpu(const vector<Blob*>& bottom, \ | ||
const vector<Blob*>& top) { NO_GPU; } | ||
|
||
namespace caffe { | ||
|
||
// Common functions and classes from std that caffe often uses. | ||
using std::vector; | ||
using std::string; | ||
using std::shared_ptr; | ||
|
||
typedef float real_t; | ||
|
||
enum DeviceMode { | ||
CPU, GPU | ||
}; | ||
|
||
/*! | ||
* \brief gpu avariable | ||
* \return true if gpu available | ||
*/ | ||
CAFFE_API bool GPUAvailable(); | ||
/*! | ||
* \brief set caffe mode | ||
* \param mode GPU or CPU | ||
* \param device GPU device id, -1 for CPU | ||
*/ | ||
CAFFE_API void SetMode(DeviceMode mode, int device); | ||
|
||
} // namespace caffe | ||
|
||
#endif // CAFFE_COMMON_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.