code: def test_scan_debugprint5():
      k = tensor.iscalar("k")
      A = tensor.dvector("A")
  
      # Symbolic description of the result
      result, updates = theano.scan(
          fn=lambda prior_result, A: prior_result * A,
          outputs_info=tensor.ones_like(A),
          non_sequences=A,
          n_steps=k,
      )
  
      final_result = tensor.grad(result[-1].sum(), A)
  
      output_str = theano.printing.debugprint(final_result, file="str")
      lines = output_str.split("\n")
  
      expected_output = """Subtensor{int64} [id A] ''
      |for{cpu,grad_of_scan_fn}.1 [id B] ''
      | |Elemwise{sub,no_inplace} [id C] ''
      | | |Subtensor{int64} [id D] ''
      | | | |Shape [id E] ''
      | | | | |for{cpu,scan_fn} [id F] ''
      | | | |   |k [id G]
      | | | |   |IncSubtensor{Set;:int64:} [id H] ''
      | | | |   | |AllocEmpty{dtype='float64'} [id I] ''
      | | | |   | | |Elemwise{add,no_inplace} [id J] ''
      | | | |   | | | |k [id G]
      | | | |   | | | |Subtensor{int64} [id K] ''
      | | | |   | | |   |Shape [id L] ''
      | | | |   | | |   | |Rebroadcast{0} [id M] ''
      | | | |   | | |   |   |InplaceDimShuffle{x,0} [id N] ''
      | | | |   | | |   |     |Elemwise{second,no_inplace} [id O] ''
      | | | |   | | |   |       |A [id P]
      | | | |   | | |   |       |InplaceDimShuffle{x} [id Q] ''
      | | | |   | | |   |         |TensorConstant{1.0} [id R]
      | | | |   | | |   |Constant{0} [id S]
      | | | |   | | |Subtensor{int64} [id T] ''
      | | | |   | |   |Shape [id U] ''
      | | | |   | |   | |Rebroadcast{0} [id M] ''
      | | | |   | |   |Constant{1} [id V]
      | | | |   | |Rebroadcast{0} [id M] ''
      | | | |   | |ScalarFromTensor [id W] ''
      | | | |   |   |Subtensor{int64} [id K] ''
      | | | |   |A [id P]
      | | | |Constant{0} [id X]
      | | |TensorConstant{1} [id Y]
      | |Subtensor{:int64:} [id Z] ''
      | | |Subtensor{::int64} [id BA] ''
      | | | |Subtensor{:int64:} [id BB] ''
      | | | | |for{cpu,scan_fn} [id F] ''
      | | | | |Constant{-1} [id BC]
      | | | |Constant{-1} [id BD]
      | | |ScalarFromTensor [id BE] ''
      | |   |Elemwise{sub,no_inplace} [id C] ''
      | |Subtensor{:int64:} [id BF] ''
      | | |Subtensor{:int64:} [id BG] ''
      | | | |Subtensor{::int64} [id BH] ''
      | | | | |for{cpu,scan_fn} [id F] ''
      | | | | |Constant{-1} [id BI]
      | | | |Constant{-1} [id BJ]
      | | |ScalarFromTensor [id BK] ''
      | |   |Elemwise{sub,no_inplace} [id C] ''
      | |Subtensor{::int64} [id BL] ''
      | | |IncSubtensor{Inc;int64::} [id BM] ''
      | | | |Elemwise{second,no_inplace} [id BN] ''
      | | | | |for{cpu,scan_fn} [id F] ''
      | | | | |InplaceDimShuffle{x,x} [id BO] ''
      | | | |   |TensorConstant{0.0} [id BP]
      | | | |IncSubtensor{Inc;int64} [id BQ] ''
      | | | | |Elemwise{second,no_inplace} [id BR] ''
      | | | | | |Subtensor{int64::} [id BS] ''
      | | | | | | |for{cpu,scan_fn} [id F] ''
      | | | | | | |Constant{1} [id BT]
      | | | | | |InplaceDimShuffle{x,x} [id BU] ''
      | | | | |   |TensorConstant{0.0} [id BP]
      | | | | |Elemwise{second} [id BV] ''
      | | | | | |Subtensor{int64} [id BW] ''
      | | | | | | |Subtensor{int64::} [id BS] ''
      | | | | | | |Constant{-1} [id BX]
      | | | | | |InplaceDimShuffle{x} [id BY] ''
      | | | | |   |Elemwise{second,no_inplace} [id BZ] ''
      | | | | |     |Sum{acc_dtype=float64} [id CA] ''
      | | | | |     | |Subtensor{int64} [id BW] ''
      | | | | |     |TensorConstant{1.0} [id R]
      | | | | |Constant{-1} [id BX]
      | | | |Constant{1} [id BT]
      | | |Constant{-1} [id CB]
      | |Alloc [id CC] ''
      | | |TensorConstant{0.0} [id BP]
      | | |Elemwise{add,no_inplace} [id CD] ''
      | | | |Elemwise{sub,no_inplace} [id C] ''
      | | | |TensorConstant{1} [id Y]
      | | |Subtensor{int64} [id CE] ''
      | |   |Shape [id CF] ''
      | |   | |A [id P]
      | |   |Constant{0} [id CG]
      | |A [id P]
      |Constant{-1} [id CH]
  
      Inner graphs of the scan ops:
  
      for{cpu,grad_of_scan_fn}.1 [id B] ''
      >Elemwise{add,no_inplace} [id CI] ''
      > |Elemwise{mul} [id CJ] ''
      > | |<TensorType(float64, vector)> [id CK] -> [id BL]
      > | |A_copy [id CL] -> [id P]
      > |<TensorType(float64, vector)> [id CM] -> [id BL]
      >Elemwise{add,no_inplace} [id CN] ''
      > |Elemwise{mul} [id CO] ''
      > | |<TensorType(float64, vector)> [id CK] -> [id BL]
      > | |<TensorType(float64, vector)> [id CP] -> [id Z]
      > |<TensorType(float64, vector)> [id CQ] -> [id CC]
  
      for{cpu,scan_fn} [id F] ''
      >Elemwise{mul,no_inplace} [id CR] ''
      > |<TensorType(float64, vector)> [id CP] -> [id H]
      > |A_copy [id CL] -> [id P]
  
      for{cpu,scan_fn} [id F] ''
      >Elemwise{mul,no_inplace} [id CR] ''
  
      for{cpu,scan_fn} [id F] ''
      >Elemwise{mul,no_inplace} [id CR] ''
  
      for{cpu,scan_fn} [id F] ''
      >Elemwise{mul,no_inplace} [id CR] ''
  
      for{cpu,scan_fn} [id F] ''
      >Elemwise{mul,no_inplace} [id CR] ''"""
  
      for truth, out in zip(expected_output.split("\n"), lines):
          assert truth.strip() == out.strip()
  
imports: from __future__ import absolute_import, print_function, division
  import logging
  from nose.plugins.skip import SkipTest
  import numpy
  from six.moves import StringIO
  import theano
  import theano.tensor
  from theano.printing import min_informative_str, debugprint
label_desc: Use image node_id 11 for calling a global function with example usage: test_scan_debugprint5() without return types