Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

mxnet_acc.h
#include <string>

typedef int (FCompute)(int, void*);
extern "C" std::string getAccName();
extern "C" FCompute* getFCompute(std::string);


enumNDArray_DType {

  kFloat32 = 0,

  kFloat64 = 1,

  kFloat16 = 2,

  kUint8 = 3,

  kInt32 = 4,

  kInt8 = 5,

  kInt64 = 6,

};


structNDArray {

  NDArray() { data = nullptr; };

  NDArray(void *data, conststd::vector<int64_t> &shape,

          NDArray_DTypedtype, std::string format)

  : data(data),shape(shape), dtype(dtype), format(format) {}


  void *data;

  std::vector<int64_t> shape;

  NDArray_DTypedtype;

  std::string format;

};


myacc.cpp - example accelerator library implementation
#include "mxnet_acc.h"

std::string getAccName() {
  return std::string("myacc");
}

extern "C" FCompute* getFCompute(std::string) {
  return 0;

}

...