conv2D.hpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #include "helper.hpp"
  16. namespace tf_lib {
  17. using namespace tensorflow;
  18. using namespace std::chrono;
  19. typedef FunctionDefHelper FDH;
  20. extern ShapeFunction conv2d_shape_fn;
  21. class Conv2DOp : public AsyncOpKernel {
  22. public:
  23. explicit Conv2DOp(OpKernelConstruction* context);
  24. void ComputeAsync(OpKernelContext* context, DoneCallback done) override;
  25. private:
  26. int instance = -1;
  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. int outputSize = sizeWithBorder;
  34. //TF_DISALLOW_COPY_AND_ASSIGN(Conv2DOp);
  35. };
  36. }
  37. #endif