code: def test_optimize_pickle(self):
      my_sum = cupy.ReductionKernel(
          "T x", "T out", "x", "a + b", "out = a", "0", "my_sum"
      )
      x = testing.shaped_arange((3, 4), cupy)
  
      with tempfile.TemporaryDirectory() as directory:
          filepath = directory + "/optimize_params"
  
          with cupyx.optimizing.optimize() as context:
              my_sum(x, axis=1)
              params_map = context._params_map
              context.save(filepath)
  
          cupy._core._optimize_config._clear_all_contexts_cache()
  
          with cupyx.optimizing.optimize() as context:
              assert params_map.keys() != context._params_map.keys()
              context.load(filepath)
              assert params_map.keys() == context._params_map.keys()
  
          with cupyx.optimizing.optimize(key="other_key") as context:
              with pytest.raises(ValueError):
                  context.load(filepath)
  
imports: import os
  import tempfile
  import unittest
  from unittest import mock
  import pytest
  import cupy
  from cupy import testing
  from cupy._core import _accelerator
label_desc: Use image node_id 5 for calling the TestOptimize obj's underlying member method code with example usage: obj.test_optimize_pickle() without return types