conv2D.hpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #ifndef CONV2D_FPGA_H
  2. #define CONV2D_FPGA_H
  3. #include "tensorflow/core/framework/op_kernel.h"
  4. #include "tensorflow/core/framework/function.h"
  5. #include <stdlib.h>
  6. #include <iostream>
  7. #include <string>
  8. #include <chrono>
  9. #include <thread>
  10. #include <future>
  11. #include <mutex>
  12. #include "../lib/mlfpga/include/connectionManager.hpp"
  13. #include "../lib/mlfpga/include/modules.hpp"
  14. #include "entrypoint.hpp"
  15. namespace tf_lib {
  16. using namespace tensorflow;
  17. using namespace std::chrono;
  18. typedef FunctionDefHelper FDH;
  19. class Conv2DOp : public AsyncOpKernel {
  20. public:
  21. explicit Conv2DOp(OpKernelConstruction* context);
  22. void ComputeAsync(OpKernelContext* context, DoneCallback done) override;
  23. private:
  24. int instance = -1;
  25. int delay = 1000;
  26. int outputSize = 28;
  27. int tagCounter = 0;
  28. int width = 224;
  29. int kernel = 5;
  30. int border = kernel/2;
  31. int sizeWithBorder = width + 2*border;
  32. int pixels = sizeWithBorder * sizeWithBorder;
  33. //TF_DISALLOW_COPY_AND_ASSIGN(Conv2DOp);
  34. };
  35. }
  36. #endif