code: def test_scan_debugprint2():
      coefficients = theano.tensor.vector("coefficients")
      x = tensor.scalar("x")
  
      max_coefficients_supported = 10000
  
      # Generate the components of the polynomial
      components, updates = theano.scan(
          fn=lambda coefficient, power, free_variable: coefficient
          * (free_variable**power),
          outputs_info=None,
          sequences=[
              coefficients,
              theano.tensor.arange(max_coefficients_supported),
          ],
          non_sequences=x,
      )
      # Sum them up
      polynomial = components.sum()
  
      output_str = theano.printing.debugprint(polynomial, file="str")
      lines = output_str.split("\n")
  
      expected_output = """Sum{acc_dtype=float64} [id A] ''
       |for{cpu,scan_fn} [id B] ''
         |Elemwise{minimum,no_inplace} [id C] ''
         | |Subtensor{int64} [id D] ''
         | | |Shape [id E] ''
         | | | |Subtensor{int64::} [id F] 'coefficients[0:]'
         | | |   |coefficients [id G]
         | | |   |Constant{0} [id H]
         | | |Constant{0} [id I]
         | |Subtensor{int64} [id J] ''
         |   |Shape [id K] ''
         |   | |Subtensor{int64::} [id L] ''
         |   |   |ARange{dtype='int64'} [id M] ''
         |   |   | |TensorConstant{0} [id N]
         |   |   | |TensorConstant{10000} [id O]
         |   |   | |TensorConstant{1} [id P]
         |   |   |Constant{0} [id Q]
         |   |Constant{0} [id R]
         |Subtensor{:int64:} [id S] ''
         | |Subtensor{int64::} [id F] 'coefficients[0:]'
         | |ScalarFromTensor [id T] ''
         |   |Elemwise{minimum,no_inplace} [id C] ''
         |Subtensor{:int64:} [id U] ''
         | |Subtensor{int64::} [id L] ''
         | |ScalarFromTensor [id V] ''
         |   |Elemwise{minimum,no_inplace} [id C] ''
         |Elemwise{minimum,no_inplace} [id C] ''
         |x [id W]
  
      Inner graphs of the scan ops:
  
      for{cpu,scan_fn} [id B] ''
       >Elemwise{mul,no_inplace} [id X] ''
       > |coefficients[t] [id Y] -> [id S]
       > |Elemwise{pow,no_inplace} [id Z] ''
       >   |x_copy [id BA] -> [id W]
       >   |<TensorType(int64, scalar)> [id BB] -> [id U]"""
  
      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 8 for calling a global function with example usage: test_scan_debugprint2() without return types