code: def pfunc(
      params,
      outputs=None,
      mode=None,
      updates=None,
      givens=None,
      no_default_updates=False,
      accept_inplace=False,
      name=None,
      rebuild_strict=True,
      allow_input_downcast=None,
      profile=None,
      on_unused_input=None,
      output_keys=None,
      fgraph: Optional[FunctionGraph] = None,
  ) -> Function:
      """
      Function-constructor for graphs with shared variables.
  
      Parameters
      ----------
      params : list of either Variable or In instances
          Function parameters, these are not allowed to be shared variables.
      outputs : list of Variables or Out instances
          Expressions to compute.
      mode : string or `pytensor.compile.mode.Mode` instance
          Compilation mode.
      updates : iterable over pairs (shared_variable, new_expression). List, tuple or dict.
          Update the values for SharedVariable inputs according to these
          expressions
      givens : iterable over pairs (Var1, Var2) of Variables. List, tuple or dict.
          The Var1 and Var2 in each pair must have the same Type. Specific
          substitutions to make in the computation graph (Var2 replaces Var1).
      no_default_updates : either bool or list of Variables
          If True, do not perform any automatic update on Variables.
          If False (default), perform them all. Else, perform automatic updates
          on all Variables that are neither in "updates" nor in
          "no_default_updates".
      accept_inplace : bool
          True iff the graph can contain inplace operations prior to the
          optimization phase (default is False). *Note* this parameter is unsupported,
          and its use is not recommended.
      name : None or string
          Attaches a name to the profiling result of this function.
      allow_input_downcast : bool
          True means that the values passed as inputs when calling the function
          can be silently downcasted to fit the dtype of the corresponding
          Variable, which may lose precision. False means that it will only be cast to a more
          general, or precise, type. None (default) is almost like
          False, but allows downcasting of Python float scalars to
          floatX.
      profile : None, True, str, or ProfileStats instance
          Accumulate profiling information into a given ProfileStats instance.
          None is the default, and means to use the value of config.profile.
          If argument is `True` then a new ProfileStats instance will be used.
          If argument is a string, a new ProfileStats instance will be created
          with that string as its `message` attribute. This profiling object will
          be available via self.profile.
      on_unused_input : {'raise', 'warn','ignore', None}
          What to do if a variable in the 'inputs' list is not used in the graph.
      fgraph
          An existing `FunctionGraph` from which to construct the returned
          `Function`.  When this is non-``None``, nothing is cloned.
  
      Returns
      -------
      A callable object that will compute the outputs (given the inputs) and
      update the implicit function arguments according to the `updates`.
  
      Notes
      -----
      Regarding givens: Be careful to make sure that these substitutions are
      independent--behaviour when ``Var1`` of one pair appears in the graph leading
      to ``Var2`` in another expression is undefined. Replacements specified with
      givens are different from optimizations in that ``Var2`` is not expected to
      be equivalent to ``Var1``.
  
      """
  
      if profile is None:
          profile = config.profile or config.print_global_stats
          if profile is False:
              profile = None
      if profile is True:
          profile = ProfileStats(message=name)
      elif isinstance(profile, str):
          profile = ProfileStats(message=profile)
  
      inputs, cloned_outputs = construct_pfunc_ins_and_outs(
          params,
          outputs,
          mode,
          updates,
          givens,
          no_default_updates,
          rebuild_strict,
          allow_input_downcast,
          fgraph=fgraph,
      )
  
      return orig_function(
          inputs,
          cloned_outputs,
          mode,
          accept_inplace=accept_inplace,
          name=name,
          profile=profile,
          on_unused_input=on_unused_input,
          output_keys=output_keys,
          fgraph=fgraph,
      )
  
file_path: pytensor/pytensor/compile/function/pfunc.py
imports: from collections.abc import Sequence
  from copy import copy
  from typing import Optional, Union, overload
  from pytensor.compile.function.types import Function, UnusedInputError, orig_function
  from pytensor.compile.io import In, Out
  from pytensor.compile.profiling import ProfileStats
  from pytensor.compile.sharedvalue import SharedVariable, shared
  from pytensor.configdefaults import config
  from pytensor.graph.basic import Constant, Variable, clone_node_and_cache
  from pytensor.graph.fg import FunctionGraph
label_desc: Use image node_id 6 for calling a global function with example usage: pfunc(params, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input, output_keys, fgraph) and returns: orig_function