code: def _get_noise_shape(x, noise_shape):
      """Noisve shape util copied from tf nn_ops."""
      # If noise_shape is none return immediately.
      if noise_shape is None:
          return array_ops.shape(x)
  
      try:
          # Best effort to figure out the intended shape.
          # If not possible, let the op to handle it.
          # In eager mode exception will show up.
          noise_shape_ = tensor_shape.as_shape(noise_shape)
      except (TypeError, ValueError):
          return noise_shape
  
      if x.shape.dims is not None and len(x.shape.dims) == len(
          noise_shape_.dims
      ):
          new_dims = []
          for i, dim in enumerate(x.shape.dims):
              if (
                  noise_shape_.dims[i].value is None
                  and dim.value is not None
              ):
                  new_dims.append(dim.value)
              else:
                  new_dims.append(noise_shape_.dims[i].value)
          return tensor_shape.TensorShape(new_dims)
  
      return noise_shape
  
file_path: tensorflow/tensorflow/dtensor/python/d_random.py
imports: from tensorflow.dtensor.python import api
  from tensorflow.dtensor.python import layout
  from tensorflow.python.eager import context
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_math_ops
  from tensorflow.python.ops import gen_stateless_random_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import shape_util
label_desc: Use image node_id 8 for calling a global function with example usage: _get_noise_shape(x, noise_shape) and returns: noise_shape, array_ops, tensor_shape, noise_shape