code: def _to_tensor(self):
      assert (
          len(self.model_inputs) == 1
      ), "MaxPool accept single input only"
      rank = len(self.model_inputs[0].zvalue.shape)
      if "storage_order" in self.onnx_attr.keys():
          assert self.onnx_attr["storage_order"] == 0
  
      if rank == 4:  # NCHW
          pool_size = [int(i) for i in self.onnx_attr["kernel_shape"]]
          if "strides" in self.onnx_attr.keys():
              strides = [int(i) for i in self.onnx_attr["strides"]]
          else:
              strides = [1 for i in self.onnx_attr["kernel_shape"]]
  
          border_mode, pads = OnnxHelper.get_padds(self.onnx_attr)
  
          maxpool = zlayers.MaxPooling2D(
              pool_size=pool_size,
              strides=strides,
              border_mode=border_mode,
              pads=pads,
          )
          return maxpool(self.model_inputs[0].zvalue)
      elif rank == 3:
          pool_length = int(self.onnx_attr["kernel_shape"][0])
          if "strides" in self.onnx_attr.keys():
              stride = int(self.onnx_attr["strides"][0])
          else:
              stride = 1
          border_mode, pads = OnnxHelper.get_padds(self.onnx_attr)
          if border_mode is None and pads is None:
              border_mode = "valid"
          if pads is None:
              pads = 0
          permute = zlayers.Permute(dims=(2, 1))(
              self.model_inputs[0].zvalue
          )
          maxpool = zlayers.MaxPooling1D(
              pool_length=pool_length,
              stride=stride,
              border_mode=border_mode,
              pad=pads,
          )(permute)
          return zlayers.Permute(dims=(2, 1))(maxpool)
      else:
          raise Exception("not supported.")
  
file_path: analytics-zoo/pyzoo/zoo/pipeline/api/onnx/mapper/maxpool.py
imports: from zoo.pipeline.api.onnx.mapper.operator_mapper import OperatorMapper
  from zoo.pipeline.api.onnx.onnx_helper import OnnxHelper
  import zoo.pipeline.api.keras.layers
  import numpy
label_desc: Use image node_id 2 for calling the MaxPoolMapper obj's underlying member method code with example usage: obj._to_tensor() and returns: maxpool, zlayers