conv2D.hpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 tagCounter = 0;
  26. int width = 224;
  27. int kernel = 5;
  28. int border = kernel/2;
  29. int sizeWithBorder = width + 2*border;
  30. int pixels = sizeWithBorder * sizeWithBorder;
  31. int outputSize = sizeWithBorder;
  32. //TF_DISALLOW_COPY_AND_ASSIGN(Conv2DOp);
  33. };
  34. }
  35. #endif