code: def may_share_memory_core(a, b):
      va = a.view()
      vb = b.view()
      ra = a.reshape((4, 5))
      rb = b.reshape((4, 5))
      ta = a.T
      tb = b.T
  
      for a_, b_, rep in [
          (a, a, True),
          (b, b, True),
          (a, b, False),
          (a, a[0], True),
          (a, a[:, 0], True),
          (a, a.T, True),
          (a, (0,), False),
          (a, 1, False),
          (a, None, False),
          (a, va, True),
          (b, vb, True),
          (va, b, False),
          (a, vb, False),
          (a, ra, True),
          (b, rb, True),
          (ra, b, False),
          (a, rb, False),
          (a, ta, True),
          (b, tb, True),
          (ta, b, False),
          (a, tb, False),
      ]:
          assert may_share_memory(a_, b_, False) == rep
          assert may_share_memory(b_, a_, False) == rep
  
      # test that it raise error when needed.
      for a_, b_, rep in [
          (a, (0,), False),
          (a, 1, False),
          (a, None, False),
      ]:
          assert may_share_memory(a_, b_, False) == rep
          assert may_share_memory(b_, a_, False) == rep
          try:
              may_share_memory(a_, b_)
              raise Exception("An error was expected")
          except TypeError:
              pass
          try:
              may_share_memory(b_, a_)
              raise Exception("An error was expected")
          except TypeError:
              pass
  
imports: from __future__ import absolute_import, print_function, division
  import numpy
  import theano
  from theano.misc.may_share_memory import may_share_memory
label_desc: Use image node_id 1 for calling a global function with example usage: may_share_memory_core(a, b) without return types