code: def _infer_fft_length_for_irfft(input_tensor, fft_rank):
      """Infers the `fft_length` argument for a `rank` IRFFT from `input_tensor`."""
      # A TensorShape for the inner fft_rank dimensions.
      fft_shape = input_tensor.get_shape()[-fft_rank:]
  
      # If any dim is unknown, fall back to tensor-based math.
      if not fft_shape.is_fully_defined():
          fft_length = _array_ops_stack.unstack(
              _array_ops.shape(input_tensor)[-fft_rank:]
          )
          fft_length[-1] = _math_ops.maximum(
              0, 2 * (fft_length[-1] - 1)
          )
          return _array_ops_stack.stack(fft_length)
  
      # Otherwise, return a constant.
      fft_length = fft_shape.as_list()
      if fft_length:
          fft_length[-1] = max(0, 2 * (fft_length[-1] - 1))
      return _ops.convert_to_tensor(fft_length, _dtypes.int32)
  
imports: import re
  import numpy
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import array_ops_stack
  from tensorflow.python.ops import gen_spectral_ops
  from tensorflow.python.ops import manip_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.util import dispatch
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 6 for calling a global function with example usage: _infer_fft_length_for_irfft(input_tensor, fft_rank) and returns: _ops, _array_ops_stack