MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Compile

Method Compile

tensorflow/compiler/tf2xla/kernels/pooling_ops.cc:169–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167 }
168
169 void Compile(XlaOpKernelContext* ctx) override {
170 auto ksize_or_error = GetKernelSize(ctx);
171 OP_REQUIRES_OK(ctx, ksize_or_error.status());
172 std::vector<int64> ksize = ksize_or_error.ValueOrDie();
173
174 auto stride_or_error = GetStride(ctx);
175 OP_REQUIRES_OK(ctx, stride_or_error.status());
176 std::vector<int64> stride = stride_or_error.ValueOrDie();
177
178 const TensorShape input_shape = ctx->InputShape(0);
179 OP_REQUIRES(ctx, input_shape.dims() == num_dims(),
180 errors::InvalidArgument("Input to ", type_string(),
181 " operator must have ", num_dims(),
182 " dimensions"));
183
184 auto pooling =
185 xla::MaxPool(ctx->Input(0), ksize, stride, padding_,
186 XlaTensorFormat(data_format_, input_shape.dims() - 2));
187 ctx->SetOutput(0, pooling);
188 }
189};
190
191class MaxPool2DOp : public MaxPoolOp {

Callers

nothing calls this directly

Calls 9

GetKernelSizeFunction · 0.85
InvalidArgumentFunction · 0.85
XlaTensorFormatFunction · 0.85
InputShapeMethod · 0.80
MaxPoolFunction · 0.50
statusMethod · 0.45
dimsMethod · 0.45
InputMethod · 0.45
SetOutputMethod · 0.45

Tested by

no test coverage detected