Initialization for TensorFlow format
| 223 | |
| 224 | // Initialization for TensorFlow format |
| 225 | void MklPoolParameters::Init(OpKernelContext* context, |
| 226 | const std::vector<int32>& ksize, |
| 227 | const std::vector<int32>& stride, Padding padding, |
| 228 | TensorFormat data_format, |
| 229 | const TensorShape& tensor_in_shape) { |
| 230 | // For max pooling, tensor_in should have 4 or 5 dimensions. |
| 231 | OP_REQUIRES(context, |
| 232 | tensor_in_shape.dims() == 4 || tensor_in_shape.dims() == 5, |
| 233 | errors::InvalidArgument("tensor_in must be 4 or 5-dimensional")); |
| 234 | |
| 235 | depth = GetTensorDim(tensor_in_shape, data_format, 'C'); |
| 236 | if (tensor_in_shape.dims() == 4) { |
| 237 | // Pool2D |
| 238 | tensor_in_cols = GetTensorDim(tensor_in_shape, data_format, 'W'); |
| 239 | tensor_in_rows = GetTensorDim(tensor_in_shape, data_format, 'H'); |
| 240 | } else { |
| 241 | // Pool3D |
| 242 | tensor_in_planes = GetTensorDim(tensor_in_shape, data_format, '0'); |
| 243 | tensor_in_rows = GetTensorDim(tensor_in_shape, data_format, '1'); |
| 244 | tensor_in_cols = GetTensorDim(tensor_in_shape, data_format, '2'); |
| 245 | } |
| 246 | tensor_in_batch = GetTensorDim(tensor_in_shape, data_format, 'N'); |
| 247 | |
| 248 | Init(context, ksize, stride, padding, data_format); |
| 249 | } |
| 250 | |
| 251 | // Initialization for OneDNN format. |
| 252 | void MklPoolParameters::Init(OpKernelContext* context, |