def get_spatial_shape(tensor, data_format='channels_last', dynamic=False):
    ' Return the tensor spatial shape (without batch and channels dimensions).\n\n    Parameters\n    ----------\n    tensor : tf.Tensor\n\n    dynamic : bool\n        If True, returns tensor which represents shape. If False, returns list of ints and/or Nones.\n\n    Returns\n    -------\n    shape : tf.Tensor or list\n    '
    if dynamic:
        shape = tf.shape(tensor)
    else:
        shape = tensor.get_shape().as_list()
    axis = (slice(1, (- 1)) if (data_format == 'channels_last') else slice(2, None))
    return shape[axis]
Return the tensor spatial shape (without batch and channels dimensions).

Parameters
----------
tensor : tf.Tensor

dynamic : bool
    If True, returns tensor which represents shape. If False, returns list of ints and/or Nones.

Returns
-------
shape : tf.Tensor or list
def get_spatial_shape(tensor, data_format='channels_last', dynamic=False):
    ' Return the tensor spatial shape (without batch and channels dimensions).\n\n    Parameters\n    ----------\n    tensor : tf.Tensor\n\n    dynamic : bool\n        If True, returns tensor which represents shape. If False, returns list of ints and/or Nones.\n\n    Returns\n    -------\n    shape : tf.Tensor or list\n    '
    if dynamic:
        shape = tf.shape(tensor)
    else:
        shape = tensor.get_shape().as_list()
    axis = (slice(1, (- 1)) if (data_format == 'channels_last') else slice(2, None))
    return shape[axis]