code: def np_maxpool3d(x, pool_size, strides, padding, data_format):
      if data_format == "channels_first":
          x = x.transpose((0, 2, 3, 4, 1))
  
      if isinstance(pool_size, int):
          pool_size = (pool_size, pool_size, pool_size)
      if isinstance(strides, int):
          strides = (strides, strides, strides)
  
      h_pool_size, w_pool_size, d_pool_size = pool_size
      h_stride, w_stride, d_stride = strides
  
      if padding == "same":
          n_batch, h_x, w_x, d_x, ch_x = x.shape
          h_padding = _same_padding(h_x, h_pool_size, h_stride)
          w_padding = _same_padding(w_x, w_pool_size, w_stride)
          d_padding = _same_padding(d_x, d_pool_size, d_stride)
          npad = [(0, 0)] * x.ndim
          npad[1] = (0, h_padding)
          npad[2] = (0, w_padding)
          npad[3] = (0, d_padding)
          x = np.pad(
              x,
              pad_width=npad,
              mode="constant",
              constant_values=-np.inf,
          )
  
      n_batch, h_x, w_x, d_x, ch_x = x.shape
      out_h = int((h_x - h_pool_size) / h_stride) + 1
      out_w = int((w_x - w_pool_size) / w_stride) + 1
      out_d = int((d_x - d_pool_size) / d_stride) + 1
  
      stride_shape = (n_batch, out_h, out_w, out_d, ch_x, *pool_size)
      strides = (
          x.strides[0],
          h_stride * x.strides[1],
          w_stride * x.strides[2],
          d_stride * x.strides[3],
          x.strides[4],
          x.strides[1],
          x.strides[2],
          x.strides[3],
      )
      windows = as_strided(x, shape=stride_shape, strides=strides)
      out = np.max(windows, axis=(5, 6, 7))
      if data_format == "channels_first":
          out = out.transpose((0, 4, 1, 2, 3))
      return out
  
imports: import numpy
  import pytest
  from absl.testing import parameterized
  from numpy.lib.stride_tricks import as_strided
  from keras import layers
  from keras import testing
label_desc: Use image node_id 4 for calling a global function with example usage: np_maxpool3d(x, pool_size, strides, padding, data_format) and returns: out