code: def test_NoOutputFromInplace():
      x = matrix()
      y = matrix()
      a = dot(x, y)
      b = tanh(a)
      c = tanh(dot(2 * x, y))
  
      # Ensure that the elemwise op that produces the output is inplace when
      # using a mode that does not include the optimization
      fct_no_opt = function([x, y], [b, c], mode="FAST_RUN")
      op = fct_no_opt.maker.fgraph.outputs[0].owner.op
      assert op.destroy_map and 0 in op.destroy_map
      op = fct_no_opt.maker.fgraph.outputs[1].owner.op
      assert op.destroy_map and 0 in op.destroy_map
  
      # Ensure that the elemwise op that produces the output is not inplace when
      # using a mode that includes the optimization
      opt = AddFeatureOptimizer(NoOutputFromInplace([1]))
      mode_opt = Mode(linker="py", optimizer="fast_run").register(
          (opt, 49.9)
      )
  
      fct_opt = function([x, y], [b, c], mode=mode_opt)
      op = fct_opt.maker.fgraph.outputs[0].owner.op
      assert op.destroy_map and 0 in op.destroy_map
      op = fct_opt.maker.fgraph.outputs[1].owner.op
      assert not op.destroy_map or 0 not in op.destroy_map
  
file_path: pytensor/tests/compile/test_mode.py
imports: import copy
  import pytest
  from pytensor.compile.function import function
  from pytensor.compile.mode import AddFeatureOptimizer, Mode, get_default_mode, get_target_language
  from pytensor.configdefaults import config
  from pytensor.graph.features import NoOutputFromInplace
  from pytensor.graph.rewriting.db import RewriteDatabaseQuery, SequenceDB
  from pytensor.link.basic import LocalLinker
  from pytensor.tensor.math import dot, tanh
  from pytensor.tensor.type import matrix, vector
label_desc: Use image node_id 2 for calling a global function with example usage: test_NoOutputFromInplace() without return types