Files
pytorch/caffe2/operators/conv_transpose_op_mobile.h
Shai Szulanski 0ddaaf6a92 [codemod][caffe2] Run clang-format - 5/7
Summary:
This directory is opted-in to clang-format but is not format-clean. This blocks continuous formatting from being enabled on fbcode, and causes hassle for other codemods that leave inconsistent formatting. This diff runs clang-format, which is widely used and considered safe.

If you are unhappy with the formatting of a particular block, please *accept this diff* and then in a stacked commit undo the change and wrap that code in `// clang-format off` and `// clang-format on`, or `/* clang-format off */` and `/* clang-format on */`.

drop-conflicts

Test Plan: sandcastleit

Reviewed By: jerryzh168

Differential Revision: D22311706

fbshipit-source-id: 1ca59a82e96156a4a5dfad70ba3e64d44c5e762a
2020-06-30 15:45:11 -07:00

48 lines
1.4 KiB
C++

#ifndef CAFFE2_OPERATORS_CONV_TRANSPOSE_MOBILE_OP_H_
#define CAFFE2_OPERATORS_CONV_TRANSPOSE_MOBILE_OP_H_
#include "caffe2/core/common.h"
#ifdef C10_MOBILE
#include "caffe2/core/context.h"
#include "caffe2/core/operator.h"
#include "caffe2/operators/conv_transpose_unpool_op_base.h"
namespace caffe2 {
template <typename T, class Context>
class ConvTransposeMobileOp final : public ConvTransposeUnpoolBase<Context> {
public:
USE_CONV_TRANSPOSE_UNPOOL_BASE_FUNCTIONS(Context);
ConvTransposeMobileOp(const OperatorDef& operator_def, Workspace* ws)
: ConvTransposeUnpoolBase<Context>(operator_def, ws) {
OPERATOR_NEEDS_FEATURE(
order_ == StorageOrder::NCHW,
"Only NCHW order is supported right now.");
OPERATOR_NEEDS_FEATURE(
this->pad_l() == 0, "operator does not handle row width padding");
OPERATOR_NEEDS_FEATURE(
this->pad_r() == 0, "operator does not handle row width padding");
OPERATOR_NEEDS_FEATURE(this->stride_w() <= 4, "stride width must be <= 4");
}
bool RunOnDeviceWithOrderNCHW() override;
bool RunOnDeviceWithOrderNHWC() override;
private:
// We store a numThreasds per-worker tiles of Y, and numThreads per-worker
// threadBuffer for the gemm output, laid out in that order.
Tensor threadBuffer_{CPU};
// Input: X, W, b
// Output: Y
INPUT_TAGS(INPUT, FILTER, BIAS);
};
} // namespace caffe2
#endif // C10_MOBILE
#endif // CAFFE2_OPERATORS_CONV_TRANSPOSE_MOBILE_OP_H_