code: def test_tensor_strict(self):
      def f(var, val):
          var.set_value(val)
  
      b = shared(np.int64([7]), strict=True)
      assert b.type == theano.tensor.lvector
      self.assertRaises(TypeError, f, b, 8.23)
  
      b = shared(np.int32([7]), strict=True)
      assert b.type == theano.tensor.ivector
      self.assertRaises(TypeError, f, b, 8.23)
  
      b = shared(np.int16([7]), strict=True)
      assert b.type == theano.tensor.wvector
      self.assertRaises(TypeError, f, b, 8.23)
  
      b = shared(np.int8([7]), strict=True)
      assert b.type == theano.tensor.bvector
      self.assertRaises(TypeError, f, b, 8.23)
  
      b = shared(np.float64([7.234]), strict=True)
      assert b.type == theano.tensor.dvector
      self.assertRaises(TypeError, f, b, 8)
  
      b = shared(np.float32([7.234]), strict=True)
      assert b.type == theano.tensor.fvector
      self.assertRaises(TypeError, f, b, 8)
  
      # np.float([7.234]) don't work
      #        b = shared(np.float([7.234]), strict=True)
      #        assert b.type == theano.tensor.dvector
      #        self.assertRaises(TypeError, f, b, 8)
  
      # This generate a generic type. Should we cast? I don't think.
      #        b = shared([7.234], strict=True)
      #        assert b.type == theano.tensor.dvector
      #        self.assertRaises(TypeError, f, b, 8)
  
      b = shared(np.zeros((5, 5), dtype="float32"))
      self.assertRaises(TypeError, f, b, np.random.rand(5, 5))
  
file_path: Theano/theano/compile/tests/test_shared.py
imports: from __future__ import absolute_import, print_function, division
  import numpy
  import unittest
  import theano
  from theano.tensor import Tensor, TensorType
  from theano.compile.sharedvalue import shared
  from theano.compile.sharedvalue import SharedVariable
  from theano.compile.sharedvalue import generic
label_desc: Use image node_id 6 for calling the Test_SharedVariable obj's underlying member method code with example usage: obj.test_tensor_strict() without return types