code: def test_can_not_infer_nb_dim(self):
      # Was reported in gh-5613. Test that we do not crash
      # or that we crash in a few other case found while
      # investigating that case
  
      img = T.tensor4("img")
      patches = T.nnet.neighbours.images2neibs(img, [16, 16])
      extractPatches = theano.function([img], patches, mode=self.mode)
  
      patsRecovery = T.matrix("patsRecovery")
      original_size = T.ivector("original_size")
  
      for mode in ["valid", "ignore_borders"]:
          out = neibs2images(
              patsRecovery, (16, 16), original_size, mode=mode
          )
          f = theano.function(
              [patsRecovery, original_size], out, mode=self.mode
          )
  
          im_val = np.ones((1, 3, 320, 320), dtype=np.float32)
          neibs = extractPatches(im_val)
          f(neibs, im_val.shape)
          # Wrong number of dimensions
          self.assertRaises(ValueError, f, neibs, (1, 1, 3, 320, 320))
          # End up with a step of 0
          # This can lead to division by zero in DebugMode
          self.assertRaises(
              (ValueError, ZeroDivisionError),
              f,
              neibs,
              (3, 320, 320, 1),
          )
  
imports: from __future__ import absolute_import, print_function, division
  import numpy
  import unittest
  import theano
  from theano import shared, function
  import theano.tensor
  from theano.tensor.nnet.neighbours import images2neibs, neibs2images, Images2Neibs
  from theano.tests import unittest_tools
  from theano import change_flags
label_desc: Use image node_id 18 for calling the T_Images2Neibs obj's underlying member method code with example usage: obj.test_can_not_infer_nb_dim() without return types