code: def shift(x, offsets):
      """Similar to np.roll, but fills with nan instead of rolling values over.
  
      Also shifts along multiple axes at the same time.
  
      Args:
        x: The input array to shift.
        offsets: How much to shift each axis, offsets[i] is the offset for the i-th
          axis.
  
      Returns:
        An array with same shape as the input, with specified shifts applied.
      """
  
      def to_slice(offset):
          return (
              slice(offset, None)
              if offset >= 0
              else slice(None, offset)
          )
  
      out = np.empty_like(x)
      out.fill(np.nan)
      ind_src = tuple(to_slice(-o) for o in offsets)
      ind_dst = tuple(to_slice(o) for o in offsets)
      out[ind_dst] = x[ind_src]
      return out
  
file_path: tf-quant-finance/tf_quant_finance/experimental/finite_difference/methods.py
imports: from autograd import elementwise_grad
  import autograd.numpy
  import pandas
  import sobol_seq
label_desc: Use image node_id 13 for calling a global function with example usage: shift(x, offsets) and returns: out, unknown