This file contains hidden or 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
// put in src/operator and build MXNet | |
#include "operator_common.h" | |
extern "C" int listOps() { | |
// get op registry | |
::dmlc::Registry<::nnvm::Op>* reg = ::dmlc::Registry<::nnvm::Op>::Get(); | |
// get list of registered op names | |
std::vector<std::string> ops = reg->ListAllNames(); |
This file contains hidden or 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
#include <math.h> | |
#include <iostream> | |
#include <algorithm> | |
#include <unordered_set> | |
#include <functional> | |
#include "lib_api.h" | |
class Node; | |
struct NodeEntry { | |
Node* node; |
This file contains hidden or 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
all: | |
g++ -o main test.cpp -ldl -std=c++11 | |
g++ -o libmylib.so -shared -fPIC -std=c++11 lib.cpp | |
cp libmylib.so libmylib2.so | |
clean: | |
rm -rf *.so main *~ |
This file contains hidden or 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
# convert from N-D coordinates to 1-D index | |
def ravel(coord,stride): | |
idx = 0 | |
# loop and multiply each coordinate by the stride | |
for i in range(len(coord)): | |
idx += coord[i] * stride[i] | |
return idx | |
# convert from a 1-D index to N-D coordinates | |
def unravel(idx,stride): |
This file contains hidden or 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
all: | |
nvcc -arch=sm_35 -std=c++11 -O2 -Icudnn/include -L cudnn/lib64 -L /usr/local/lib test.cu -o test -lcudnn -I. -D$(FLAGS) |