docstr: Wrapper around the scipy optimizer.
  
  :param compile_cache_size: The number of compiled evalutation functions to cache for calls
      to `minimize`. Only applies when `compile` argument to `minimize` is True.
  
      The compiled evaluation functions are cached so that subsequent calls to `minimize` with
      the same `closure`, `variables`, `allow_unused_variables`, and `tf_fun_args` will reuse
      a previously compiled function. Up to `compile_cache_size` most recent functions are
      cached. This can be disabled by setting `compile_cache_size` to 0.
docstr_tok: ["Wrapper","around","the","scipy","optimizer",".",":","param","compile_cache_size",":","The","number","of","compiled","evalutation","functions","to","cache","for","calls","to","`","minimize","`",".","Only","applies","when","`","compile","`","argument","to","`","minimize","`","is","True",".","The","compiled","evaluation","functions","are","cached","so","that","subsequent","calls","to","`","minimize","`","with","the","same","`","closure","`",",","`","variables","`",",","`","allow_unused_variables","`",",","and","`","tf_fun_args","`","will","reuse","a","previously","compiled","function",".","Up","to","`","compile_cache_size","`","most","recent","functions","are","cached",".","This","can","be","disabled","by","setting","`","compile_cache_size","`","to","0","."]
code: def __init__(self, compile_cache_size: int = 2) -> None:
      """
      Wrapper around the scipy optimizer.
  
      :param compile_cache_size: The number of compiled evalutation functions to cache for calls
          to `minimize`. Only applies when `compile` argument to `minimize` is True.
  
          The compiled evaluation functions are cached so that subsequent calls to `minimize` with
          the same `closure`, `variables`, `allow_unused_variables`, and `tf_fun_args` will reuse
          a previously compiled function. Up to `compile_cache_size` most recent functions are
          cached. This can be disabled by setting `compile_cache_size` to 0.
      """
      self.compile_cache: OrderedDict[
          Tuple[
              Callable[[], Any],
              Tuple[int, ...],
              FrozenSet[Tuple[str, Any]],
              bool,
          ],
          tf.function,
      ] = OrderedDict()
  
      if compile_cache_size < 0:
          raise ValueError(
              "The 'compile_cache_size' argument must be non-negative, got {}.".format(
                  compile_cache_size
              )
          )
      self.compile_cache_size = compile_cache_size
  
imports: import warnings
  from collections import OrderedDict
  from typing import Any, Callable, FrozenSet, Iterable, List, Mapping, Optional, Sequence, Tuple, Union
  import numpy
  import scipy.optimize
  import tensorflow
  from scipy.optimize import OptimizeResult
  from ..base import AnyNDArray
  from ..monitor.base import Monitor
label_desc: Use image node_id 1 to create a new Scipy object  with example: obj = Scipy(compile_cache_size)