class_docstr: Partial testing.
  
  What could be tested:
  - increment vs set
  - thing incremented: scalar, vector, matrix,
  - increment/set: constant, scalar, vector, matrix
  - indices: scalar vs slice, constant vs variable, out of bound, ...
  - inplace
  
  NOTE: these are the same tests as test_incsubtensor.py, but using
  the new (read: not deprecated) inc_subtensor, set_subtensor
  functions.
class_docstr_tok: ["Partial","testing",".","What","could","be","tested",":","-","increment","vs","set","-","thing","incremented",":","scalar",",","vector",",","matrix",",","-","increment\/set",":","constant",",","scalar",",","vector",",","matrix","-","indices",":","scalar","vs","slice",",","constant","vs","variable",",","out","of","bound",",","...","-","inplace","NOTE",":","these","are","the","same","tests","as","test_incsubtensor.py",",","but","using","the","new","(","read",":","not","deprecated",")","inc_subtensor",",","set_subtensor","functions","."]
code: def test_simple_2d(self):
      # Increments or sets part of a tensor by a scalar using full slice and
      # a partial slice depending on a scalar.
  
      a = tt.dmatrix()
      increment = tt.dscalar()
      sl1 = slice(None)
      sl2_end = tt.lscalar()
      sl2 = slice(sl2_end)
  
      for do_set in [False, True]:
          if do_set:
              resut = tt.set_subtensor(a[sl1, sl2], increment)
          else:
              resut = tt.inc_subtensor(a[sl1, sl2], increment)
  
          f = theano.function([a, increment, sl2_end], resut)
  
          val_a = np.ones((5, 5))
          val_inc = 2.3
          val_sl2_end = 2
  
          result = f(val_a, val_inc, val_sl2_end)
  
          expected_result = np.copy(val_a)
          if do_set:
              expected_result[:, :val_sl2_end] = val_inc
          else:
              expected_result[:, :val_sl2_end] += val_inc
  
          utt.assert_allclose(result, expected_result)
  
file_path: Theano/theano/tensor/tests/test_inc_subtensor.py
imports: from __future__ import absolute_import, print_function, division
  import numpy
  import unittest
  from theano.tests import unittest_tools
  import theano
  import theano.tensor
label_desc: Use image node_id 2 for calling the Test_inc_subtensor obj's underlying member method code with example usage: obj.test_simple_2d() without return types