{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "ee453d40",
   "metadata": {},
   "outputs": [],
   "source": [
    "import sys, os\n",
    "sys.path.append(os.path.abspath(\"..\"))\n",
    "\n",
    "from datasets.datasets import SyntheticFACE, SyntheticMoons, Dataset, CaliforniaHousing, GermanCredit, GermanCredit_OneHot, GiveMeSomeCredit, AdultIncome, AdultIncome_OneHot\n",
    "from visualisation import *\n",
    "\n",
    "from models.mlp_pytorch import PyTorchMLP\n",
    "\n",
    "from conformal.split_conformal import SplitConformalPrediction\n",
    "from conformal.localised_conformal_baselcp import BaseLCP\n",
    "from conformal.localised_conformal_tree import ConformalCONFEXTree\n",
    "\n",
    "from counterfactual_explanations.counterfactual_benchmarker import *\n",
    "from counterfactual_explanations.gradient_based.auxillary_models import *\n",
    "from counterfactual_explanations.gradient_based.cf_gradient_based import *\n",
    "from counterfactual_explanations.gradient_based.losses import *\n",
    "\n",
    "from counterfactual_explanations.milp_based.cf_conformal import *\n",
    "from counterfactual_explanations.milp_based.cf_mindist import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "f1292775",
   "metadata": {},
   "outputs": [],
   "source": [
    "%load_ext autoreload\n",
    "%autoreload 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "00a647ab",
   "metadata": {},
   "outputs": [],
   "source": [
    "Dataset = SyntheticFACE\n",
    "factual = np.array([1, 3])\n",
    "y_target = 1 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "134cef74",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 163804 characters]",
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "dataset = Dataset(0.6, 0.2, 0.2)\n",
    "X_train, y_train, X_calib, y_calib, X_test, y_test = dataset.get_X_y_split()\n",
    "plot_split_dataset(X_train, X_test, y_train, y_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "1a6320b7",
   "metadata": {},
   "outputs": [],
   "source": [
    "# model = PyTorchMLP(config={\"hidden_dims\": [10, 5]}, input_properties=dataset.input_properties) \n",
    "# model.train(X_train, y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "a86e8297",
   "metadata": {},
   "outputs": [],
   "source": [
    "model = PyTorchMLP(config={}, input_properties=dataset.input_properties)\n",
    "model.load(\"/Users/abilkhoo/CONFEX+ copy/method/synthethic.pt\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "3b99e94f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 169332 characters]",
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_decision_boundary(model, X_train, X_test, y_train, y_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "b10fc3b8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Set parameter WLSAccessID\n",
      "Set parameter WLSSecret\n",
      "Set parameter LicenseID to value 2688232\n",
      "Academic license 2688232 - for non-commercial use only - registered to am___@kcl.ac.uk\n",
      "Set parameter TimeLimit to value 60\n",
      "Gurobi Optimizer version 11.0.3 build v11.0.3rc0 (mac64[arm] - Darwin 23.6.0 23G80)\n",
      "\n",
      "CPU model: Apple M3 Pro\n",
      "Thread count: 12 physical cores, 12 logical processors, using up to 12 threads\n",
      "\n",
      "Academic license 2688232 - for non-commercial use only - registered to am___@kcl.ac.uk\n",
      "Optimize a model with 24 rows, 38 columns and 111 nonzeros\n",
      "Model fingerprint: 0xa8f8395a\n",
      "Model has 15 general constraints\n",
      "Variable types: 38 continuous, 0 integer (0 binary)\n",
      "Coefficient statistics:\n",
      "  Matrix range     [2e-03, 1e+00]\n",
      "  Objective range  [1e+00, 1e+00]\n",
      "  Bounds range     [0e+00, 0e+00]\n",
      "  RHS range        [4e-02, 3e+00]\n",
      "Presolve added 11 rows and 26 columns\n",
      "Presolve time: 0.00s\n",
      "Presolved: 35 rows, 64 columns, 143 nonzeros\n",
      "Presolved model has 30 SOS constraint(s)\n",
      "Variable types: 34 continuous, 30 integer (30 binary)\n",
      "\n",
      "Root relaxation: objective 0.000000e+00, 24 iterations, 0.00 seconds (0.00 work units)\n",
      "\n",
      "    Nodes    |    Current Node    |     Objective Bounds      |     Work\n",
      " Expl Unexpl |  Obj  Depth IntInf | Incumbent    BestBd   Gap | It/Node Time\n",
      "\n",
      "     0     0    0.00000    0   10          -    0.00000      -     -    0s\n",
      "     0     0    0.00000    0   10          -    0.00000      -     -    0s\n",
      "     0     2    0.00000    0   10          -    0.00000      -     -    0s\n",
      "*  147    68              11       2.7097588    0.44360  83.6%   1.7    0s\n",
      "*  178    35              11       2.7065976    0.44360  83.6%   1.6    0s\n",
      "H  189    35                       2.5936665    0.44360  82.9%   1.6    0s\n",
      "H  243     2                       1.9411312    0.75788  61.0%   1.4    0s\n",
      "*  271     3              13       1.8898901    0.75788  59.9%   1.3    0s\n",
      "H  273     3                       1.2924723    0.75788  41.4%   1.3    0s\n",
      "*  280     0              13       1.0848524    1.08485  0.00%   1.3    0s\n",
      "\n",
      "Explored 281 nodes (384 simplex iterations) in 0.01 seconds (0.00 work units)\n",
      "Thread count was 12 (of 12 available processors)\n",
      "\n",
      "Solution count 7: 1.08485 1.29247 1.88989 ... 2.70976\n",
      "\n",
      "Optimal solution found (tolerance 1.00e-04)\n",
      "Best objective 1.084852447561e+00, best bound 1.084852447561e+00, gap 0.0000%\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 170304 characters]",
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#Min distance CF\n",
    "cf_gen = MinDistanceCF(model, dataset.input_properties, config={\"db_distance\":0.05})\n",
    "counterfactual = cf_gen.generate_counterfactual(factual, y_target)\n",
    "plot_counterfactual(factual, counterfactual, model, X_train, X_test, y_train, y_test, faded_background=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "c9589805",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Set parameter TimeLimit to value 60\n",
      "Gurobi Optimizer version 11.0.3 build v11.0.3rc0 (mac64[arm] - Darwin 23.6.0 23G80)\n",
      "\n",
      "CPU model: Apple M3 Pro\n",
      "Thread count: 12 physical cores, 12 logical processors, using up to 12 threads\n",
      "\n",
      "Academic license 2688232 - for non-commercial use only - registered to am___@kcl.ac.uk\n",
      "Optimize a model with 27 rows, 40 columns and 117 nonzeros\n",
      "Model fingerprint: 0x4816e8d0\n",
      "Model has 15 general constraints\n",
      "Variable types: 40 continuous, 0 integer (0 binary)\n",
      "Coefficient statistics:\n",
      "  Matrix range     [2e-03, 1e+00]\n",
      "  Objective range  [1e+00, 1e+00]\n",
      "  Bounds range     [0e+00, 0e+00]\n",
      "  RHS range        [4e-02, 3e+00]\n",
      "Presolve added 8 rows and 24 columns\n",
      "Presolve time: 0.00s\n",
      "Presolved: 35 rows, 64 columns, 143 nonzeros\n",
      "Presolved model has 30 SOS constraint(s)\n",
      "Variable types: 34 continuous, 30 integer (30 binary)\n",
      "\n",
      "Root relaxation: objective 0.000000e+00, 24 iterations, 0.00 seconds (0.00 work units)\n",
      "\n",
      "    Nodes    |    Current Node    |     Objective Bounds      |     Work\n",
      " Expl Unexpl |  Obj  Depth IntInf | Incumbent    BestBd   Gap | It/Node Time\n",
      "\n",
      "     0     0    0.00000    0   10          -    0.00000      -     -    0s\n",
      "     0     0    0.00000    0   10          -    0.00000      -     -    0s\n",
      "     0     2    0.00000    0   10          -    0.00000      -     -    0s\n",
      "*  184    52              12       3.5973011    0.44360  87.7%   2.1    0s\n",
      "H  206    26                       2.6666016    0.44360  83.4%   2.0    0s\n",
      "*  259     4              11       1.7186209    0.75788  55.9%   1.7    0s\n",
      "*  272     4              12       1.3455485    1.34555  0.00%   1.7    0s\n",
      "\n",
      "Explored 277 nodes (478 simplex iterations) in 0.02 seconds (0.00 work units)\n",
      "Thread count was 12 (of 12 available processors)\n",
      "\n",
      "Solution count 4: 1.34555 1.71862 2.6666 3.5973 \n",
      "\n",
      "Optimal solution found (tolerance 1.00e-04)\n",
      "Best objective 1.345548503558e+00, best bound 1.345548503558e+00, gap 0.0000%\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 162708 characters]",
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "conformalCF = ConformalCF(model, dataset.input_properties, config={\"conformal_class\": SplitConformalPrediction, \"conformal_config\": {\"alpha\": 0.01}})\n",
    "conformalCF.setup(X_train, y_train, X_calib, y_calib)\n",
    "counterfactual_conformal = conformalCF.generate_counterfactual(factual, y_target)\n",
    "plot_counterfactual(factual, counterfactual_conformal, model, X_train, X_test, y_train, y_test, conformal=conformalCF.conformal)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "b2307b77",
   "metadata": {},
   "outputs": [],
   "source": [
    "ccf = {\"alpha\": 0.05,\n",
    "        \"scorefn_name\":'linear2',\n",
    "        \"kernel_name\":'box_l1', \n",
    "        \"kernel_bandwidth\": 0.3}\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "ef8a5734",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2.8797831535339355\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 93248 characters]",
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "conformal = BaseLCP(model, dataset.input_properties, ccf)\n",
    "print(conformal.calibrate(X_calib, y_calib, np.array([0, 0])))\n",
    "plot_conformal_prediction(model, conformal, X_calib, X_calib, y_calib, y_calib)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "0b3b8629",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Set parameter TimeLimit to value 60\n",
      "Gurobi Optimizer version 11.0.3 build v11.0.3rc0 (mac64[arm] - Darwin 23.6.0 23G80)\n",
      "\n",
      "CPU model: Apple M3 Pro\n",
      "Thread count: 12 physical cores, 12 logical processors, using up to 12 threads\n",
      "\n",
      "Academic license 2688232 - for non-commercial use only - registered to am___@kcl.ac.uk\n",
      "Optimize a model with 2422 rows, 2674 columns and 5862 nonzeros\n",
      "Model fingerprint: 0x35ce1468\n",
      "Model has 1 quadratic constraint\n",
      "Model has 254 general constraints\n",
      "Variable types: 2195 continuous, 479 integer (479 binary)\n",
      "Coefficient statistics:\n",
      "  Matrix range     [2e-03, 1e+03]\n",
      "  QMatrix range    [1e+00, 1e+00]\n",
      "  QLMatrix range   [1e+00, 1e+00]\n",
      "  Objective range  [1e+00, 1e+00]\n",
      "  Bounds range     [1e+00, 1e+00]\n",
      "  RHS range        [1e-06, 1e+03]\n",
      "Presolve removed 323 rows and 579 columns\n",
      "Presolve time: 0.19s\n",
      "Presolved: 2099 rows, 2095 columns, 12029 nonzeros\n",
      "Presolved model has 478 SOS constraint(s)\n",
      "Variable types: 1470 continuous, 625 integer (505 binary)\n",
      "\n",
      "Root relaxation: objective 0.000000e+00, 536 iterations, 0.00 seconds (0.01 work units)\n",
      "\n",
      "    Nodes    |    Current Node    |     Objective Bounds      |     Work\n",
      " Expl Unexpl |  Obj  Depth IntInf | Incumbent    BestBd   Gap | It/Node Time\n",
      "\n",
      "     0     0    0.00000    0   15          -    0.00000      -     -    0s\n",
      "     0     0    0.00000    0  137          -    0.00000      -     -    0s\n",
      "     0     0    0.00000    0   13          -    0.00000      -     -    0s\n",
      "     0     0    0.00000    0   19          -    0.00000      -     -    0s\n",
      "     0     0    0.00000    0   20          -    0.00000      -     -    0s\n",
      "     0     0    0.00000    0   16          -    0.00000      -     -    0s\n",
      "     0     0    0.00000    0   16          -    0.00000      -     -    0s\n",
      "     0     0    0.00000    0   16          -    0.00000      -     -    0s\n",
      "     0     0    0.00000    0   16          -    0.00000      -     -    0s\n",
      "     0     2    0.00000    0   16          -    0.00000      -     -    0s\n",
      "*  356   150              16      20.5582009    0.00000   100%  18.1    0s\n",
      "*  770   304              33      20.0233863    0.24851  98.8%  11.4    0s\n",
      "  5090  1039    4.93392    6    4   20.02339    1.00055  95.0%   5.0    5s\n",
      "H 5631  1087                       5.1302465    1.04369  79.7%   6.8    8s\n",
      "* 6124  1029              59       3.5240309    1.04371  70.4%   6.9    9s\n",
      "H 6670   847                       3.1578240    1.11169  64.8%   6.9    9s\n",
      "H 6695   788                       3.0996761    1.11169  64.1%   6.9    9s\n",
      "H 6706   741                       2.8508138    1.11169  61.0%   6.9    9s\n",
      "H 6716   697                       2.8499258    1.11169  61.0%   6.9    9s\n",
      "  7115   662    1.73702   70   35    2.84993    1.15336  59.5%   6.8   10s\n",
      "* 7774   491              58       2.7331690    2.40378  12.1%   6.4   10s\n",
      "\n",
      "Cutting planes:\n",
      "  MIR: 3\n",
      "  Flow cover: 4\n",
      "\n",
      "Explored 8461 nodes (51550 simplex iterations) in 10.55 seconds (21.59 work units)\n",
      "Thread count was 12 (of 12 available processors)\n",
      "\n",
      "Solution count 9: 2.73317 2.84993 2.85081 ... 20.5582\n",
      "\n",
      "Optimal solution found (tolerance 1.00e-04)\n",
      "Best objective 2.733168963358e+00, best bound 2.733168963358e+00, gap 0.0000%\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 164620 characters]",
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "conformalCF_baselcp = ConformalCF(model, dataset.input_properties, {\"conformal_class\": BaseLCP, \"conformal_config\": ccf})\n",
    "conformalCF_baselcp.setup(X_train, y_train, X_calib, y_calib)\n",
    "counterfactual_conformalbaselcp = conformalCF_baselcp.generate_counterfactual(factual, y_target)\n",
    "plot_counterfactual(factual, counterfactual_conformalbaselcp, model, X_train, X_test, y_train, y_test, conformal=conformalCF_baselcp.conformal)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "46e93c0a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 170908 characters]",
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "wachter_generator = WachterGenerator(model, dataset.input_properties, {})\n",
    "wachter_generator.setup(X_train, y_train, X_calib, y_calib)\n",
    "wachter_cf = wachter_generator.generate_counterfactual(factual, y_target)\n",
    "plot_counterfactual(factual, wachter_cf, model, X_train, X_test, y_train, y_test, conformal=None)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "2cdfcc77",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor(3.6709, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6505, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6300, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6096, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5891, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5687, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5483, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5279, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5075, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4872, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4668, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4465, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4262, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4059, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3856, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3654, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3452, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3251, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3049, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2849, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2648, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2448, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2249, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2050, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.1851, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.1653, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.1456, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.1259, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.1063, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.0718, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.0384, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.9679, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.9313, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.8943, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.8569, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.8194, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.7819, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.7444, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.7072, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.6703, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.6338, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.5978, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.5624, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.5276, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.4934, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.4601, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.4275, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.3957, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.3648, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.3347, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.3055, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.2772, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.2497, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.2230, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.1971, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.1719, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.1474, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.1235, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.1002, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.0774, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.0551, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.0331, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.0114, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.9899, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.9685, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.9427, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.9166, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.8902, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.8634, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.8364, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.8090, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.7814, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.7534, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.7251, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.6966, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.6679, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.6390, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.6100, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.5810, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.5519, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.5228, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.4939, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.4652, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.4366, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.4084, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.3805, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.3530, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.3259, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.2992, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.2731, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.2475, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.2225, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.1980, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.1741, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.1508, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.1281, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.1060, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.0844, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.0634, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.0430, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.0231, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.9848, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.9663, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.9482, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.9306, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.9133, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.8963, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.8796, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.8631, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.8469, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.8309, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.8150, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.7993, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.7837, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.7681, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.7527, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.7374, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.7221, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.7068, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6917, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6766, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6616, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6468, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6321, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6175, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5892, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5755, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5622, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5492, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5367, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5247, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5132, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5023, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4919, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4826, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4752, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4683, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4619, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4561, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4507, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4457, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4412, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4371, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4313, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4251, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4192, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4135, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4081, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4031, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3985, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3942, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3904, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3869, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3838, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3811, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3787, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3766, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3748, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3733, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3721, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3710, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3702, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3696, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3691, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3688, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3687, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3687, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3687, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3689, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3692, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3696, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3701, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3706, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3712, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3718, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3725, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3733, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3740, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3749, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3757, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3766, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3775, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3784, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3793, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3803, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3813, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3823, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3833, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3843, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3853, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3864, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3874, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3884, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3895, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3906, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3916, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3927, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3937, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3948, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3959, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3969, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3980, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3991, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4002, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4012, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4023, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4044, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4055, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4065, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4076, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4086, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4097, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4107, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4118, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4128, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4139, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4149, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4159, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4170, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4180, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4190, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4200, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4210, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4220, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4230, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4240, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4250, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4260, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4270, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4280, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4290, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4299, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4309, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4319, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4329, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4338, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4348, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4357, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4367, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4376, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4385, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4395, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4404, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4413, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4423, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4432, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4441, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4450, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4459, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4468, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4477, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4486, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4495, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4504, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4512, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4521, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4530, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4538, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4547, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4556, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4564, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4573, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4581, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4590, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4598, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4606, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4615, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4623, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4631, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4640, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4648, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4656, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4664, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4672, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4680, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4688, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4696, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4704, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4712, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4720, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4727, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4735, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4743, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4751, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4758, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4766, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4774, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4781, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4789, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4796, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4804, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4811, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4818, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4826, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4833, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4840, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4848, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4855, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4862, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4869, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4876, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4884, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4891, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4898, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4905, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4912, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4919, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4926, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4932, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4939, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4946, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4953, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4960, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4966, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4973, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4980, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4986, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4993, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5000, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5006, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5013, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5019, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5026, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5032, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5039, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5045, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5052, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5058, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5064, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5071, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5077, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5083, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5089, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5096, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5102, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5108, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5114, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5120, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5126, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5132, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5138, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5144, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5150, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5156, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5162, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5168, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5174, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5180, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5186, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5191, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5197, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5203, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5209, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5214, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5220, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5226, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5232, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5237, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5243, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5248, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5254, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5259, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5265, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5271, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5276, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5281, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5287, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5292, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5298, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5303, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5308, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5314, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5319, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5324, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5330, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5335, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5340, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5345, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5351, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5356, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5361, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5366, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5371, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5376, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5381, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5387, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5392, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5397, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5402, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5407, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5412, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5417, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5422, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5426, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5431, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5436, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5441, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5446, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5451, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5456, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5460, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5465, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5470, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5475, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5479, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5484, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5489, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5494, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5498, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5503, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5508, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5512, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5517, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5521, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5526, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5531, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5535, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5540, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5544, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5549, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5553, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5558, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5562, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5566, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5571, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5575, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5580, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5584, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5588, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5593, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5597, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5601, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5606, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5610, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5614, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5619, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5623, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5627, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5631, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5636, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5640, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5644, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5648, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5652, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5656, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5661, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5665, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5669, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5673, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5677, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5681, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5685, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5689, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5693, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5697, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5701, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5705, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5709, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5713, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5717, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5721, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5725, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5729, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5733, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5737, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5740, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5744, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5748, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5752, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5756, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5760, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5763, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5767, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5771, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5775, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5779, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5782, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5786, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5790, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5793, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5797, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5801, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5805, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5808, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5812, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5816, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5819, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5823, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5826, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5830, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5834, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5837, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5841, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5844, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5848, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5851, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5855, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5859, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5862, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5866, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5869, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5873, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5876, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5879, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5883, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5886, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5890, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5893, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5897, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5900, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5903, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5907, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5910, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5914, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5917, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5920, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5924, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5927, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5930, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5934, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5937, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5940, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5943, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5947, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5950, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5953, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5957, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5960, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5963, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5966, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5969, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5973, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5976, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5979, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5982, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5985, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5989, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5992, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5995, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5998, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6001, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6004, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6007, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6010, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6013, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6017, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6020, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6023, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6026, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6029, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6032, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6041, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6044, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6047, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6050, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6053, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6056, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6059, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6062, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6065, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6068, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6071, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6074, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6077, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6080, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6082, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6085, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6088, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6091, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6094, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6097, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6100, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6103, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6106, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6108, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6111, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6114, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6117, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6120, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6123, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6125, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6128, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6131, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6134, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6137, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6139, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6142, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6145, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6148, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6150, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6153, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6156, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6159, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6161, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6164, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6167, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6169, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6172, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6175, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6177, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6180, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6183, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6185, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6188, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6191, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6193, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6196, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6199, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6201, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6204, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6206, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6209, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6212, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6214, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6217, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6219, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6222, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6225, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6227, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6230, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6232, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6235, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6237, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6240, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6242, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6245, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6247, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6250, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6252, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6255, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6257, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6260, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6262, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6265, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6267, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6270, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6272, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6275, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6277, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6280, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6282, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6285, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6287, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6289, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6292, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6294, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6297, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6299, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6301, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6304, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6306, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6309, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6311, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6313, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6316, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6318, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6320, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6323, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6325, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6327, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6330, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6332, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6334, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6337, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6339, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6341, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6344, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6346, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6348, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6350, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6353, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6355, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6357, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6360, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6362, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6364, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6366, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6369, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6371, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6373, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6375, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6378, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6380, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6382, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6384, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6386, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6389, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6391, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6393, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6395, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6397, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6400, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6402, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6404, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6406, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6408, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6410, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6413, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6415, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6417, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6419, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6421, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6423, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6425, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6428, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6430, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6432, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6434, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6436, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6438, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6440, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6442, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6444, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6446, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6449, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6451, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6453, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6455, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6457, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6459, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6461, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6463, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6465, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6467, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6469, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6471, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6473, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6475, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6477, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6479, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6481, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6483, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6485, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6487, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6489, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6491, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6493, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6495, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6497, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6499, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6501, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6503, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6505, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6507, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6509, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6511, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6513, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6515, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6517, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6519, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6521, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6523, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6525, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6527, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6529, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6531, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6532, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6534, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6536, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6538, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6540, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6542, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6544, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6546, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6548, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6550, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6551, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6553, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6555, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6557, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6559, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6561, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6563, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6564, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6566, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6568, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6570, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6572, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6574, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6576, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6577, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6579, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6581, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6583, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6585, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6587, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6588, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6590, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6592, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6594, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6596, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6597, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6599, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6601, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6603, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6605, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6606, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6608, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6610, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6612, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6613, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6615, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6617, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6619, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6620, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6622, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6624, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6626, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6627, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6629, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6631, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6633, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6634, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6636, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6638, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6640, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6641, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6643, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6645, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6646, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6648, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6650, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6652, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6653, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6655, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6657, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6658, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6660, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6662, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6663, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6665, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6667, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6668, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6670, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6672, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6673, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6675, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6677, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6678, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6680, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6682, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6683, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6685, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6687, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6688, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6690, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6692, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6693, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6695, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6696, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6698, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6700, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6701, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6703, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6704, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6706, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6708, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6709, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6711, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6712, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6714, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6716, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6717, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6719, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6720, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6722, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6724, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6725, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6727, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6728, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6730, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6731, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6733, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6735, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6736, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6738, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6739, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6741, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6742, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6744, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6745, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6747, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6749, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6750, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6752, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6753, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6755, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6756, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6758, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6759, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6761, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6762, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6764, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6765, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6767, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6768, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6770, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6771, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6773, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6774, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6776, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6777, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6779, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6780, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6782, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6783, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6785, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6786, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6788, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6789, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6791, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6792, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6794, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6795, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6796, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6798, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6799, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6801, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6802, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6804, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6805, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6807, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6808, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6810, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6811, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6812, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6814, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6815, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6817, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6818, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6820, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6821, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6822, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6824, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6825, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6827, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6828, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6829, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6831, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6832, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6834, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6835, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6837, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6838, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6839, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6841, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6842, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6843, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6845, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6846, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6848, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6849, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6850, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6852, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6853, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6855, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6856, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6857, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6859, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6860, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6861, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6863, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6864, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6865, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6867, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6868, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6870, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6871, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6872, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6874, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6875, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6876, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6878, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6879, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6880, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6882, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6883, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6884, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6886, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6887, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6888, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6890, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6891, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6892, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6894, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6895, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6896, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6897, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6899, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6900, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6901, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6903, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6904, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6905, device='mps:0', grad_fn=<AddBackward0>)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 172556 characters]",
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "ecco_generator = ECCCOGenerator(model, dataset.input_properties, {\"conformal_config\": {\"alpha\": 0.01}})\n",
    "ecco_generator.setup(X_train, y_train, X_calib, y_calib)\n",
    "ecf = ecco_generator.generate_counterfactual(factual, y_target)\n",
    "plot_counterfactual(factual, ecf, model, X_train, X_test, y_train, y_test, conformal=None)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "026ed127",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor(3.7075, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6494, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5915, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5338, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4763, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4190, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3619, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3051, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2484, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.1921, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.1360, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.0802, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.0247, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.9695, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.9146, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.8600, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.8059, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.7520, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.6986, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.6456, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.5930, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.5408, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.4891, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.4379, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.3871, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.3369, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.2872, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.2380, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.1894, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.1414, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.0940, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.0472, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(2.0010, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.9479, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.7152, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.5031, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.3133, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.1461, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(1.0010, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.8766, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.7707, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6811, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.6054, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.5413, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4870, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4408, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.4012, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3671, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3376, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.3119, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.2894, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.2696, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.2521, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.2364, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.2225, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.2099, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.1986, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.1884, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.1791, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.1706, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.1628, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.1556, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.1490, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.1430, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.1373, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.1321, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.1272, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.1227, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.1184, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.1145, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.1107, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.1072, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.1040, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.1008, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0979, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0951, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0925, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0900, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0876, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0854, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0833, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0812, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0793, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0774, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0756, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0739, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0723, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0708, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0693, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0678, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0665, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0651, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0639, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0626, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0614, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0603, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0592, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0582, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0571, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0561, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0552, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0543, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0534, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0525, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0517, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0508, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0501, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0493, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0485, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0478, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0471, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0464, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0458, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0451, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0445, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0439, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0433, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0427, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0422, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0416, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0411, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0406, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0401, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0396, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0391, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0386, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0381, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0377, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0373, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0368, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0364, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0360, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0356, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0352, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0348, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0344, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0341, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0337, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0334, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0330, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0327, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0323, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0320, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0317, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0314, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0311, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0308, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0305, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0302, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0299, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0296, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0293, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0291, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0288, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0286, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0283, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0280, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0278, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0276, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0273, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0271, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0269, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0266, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0264, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0262, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0260, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0258, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0256, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0253, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0251, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0249, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0248, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0246, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0244, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0242, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0240, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0238, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0236, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0235, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0233, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0231, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0230, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0228, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0226, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0225, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0223, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0221, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0220, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0218, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0217, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0215, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0214, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0212, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0211, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0210, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0208, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0207, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0206, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0204, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0203, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0202, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0200, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0199, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0198, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0197, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0195, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0194, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0193, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0192, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0191, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0189, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0188, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0187, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0186, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0185, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0184, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0183, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0182, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0181, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0180, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0179, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0178, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0177, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0176, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0175, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0174, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0173, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0172, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0171, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0170, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0169, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0168, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0167, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0166, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0165, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0165, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0164, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0163, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0162, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0161, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0160, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0160, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0159, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0158, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0157, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0156, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0156, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0155, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0154, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0153, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0153, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0152, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0151, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0150, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0150, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0149, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0148, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0148, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0147, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0146, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0145, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0145, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0144, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0143, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0143, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0142, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0142, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0141, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0140, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0140, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0139, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0138, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0138, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0137, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0137, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0136, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0135, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0135, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0134, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0134, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0133, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0133, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0132, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0131, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0131, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0130, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0130, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0129, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0129, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0128, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0128, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0127, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0127, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0126, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0126, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0125, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0125, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0124, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0124, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0123, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0123, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0122, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0122, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0121, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0121, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0120, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0120, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0119, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0119, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0118, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0118, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0118, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0117, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0117, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0116, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0116, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0115, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0115, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0115, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0114, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0114, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0113, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0113, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0112, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0112, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0112, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0111, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0111, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0111, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0110, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0110, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0109, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0109, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0109, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0108, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0108, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0107, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0107, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0107, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0106, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0106, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0106, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0105, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0105, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0105, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0104, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0104, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0104, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0103, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0103, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0103, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0102, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0102, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0102, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0101, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0101, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0101, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0100, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0100, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0100, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0099, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0099, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0099, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0098, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0098, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0098, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0097, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0097, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0097, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0096, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0096, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0096, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0096, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0095, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0095, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0095, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0094, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0094, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0094, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0094, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0093, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0093, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0093, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0092, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0092, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0092, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0092, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0091, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0091, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0091, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0091, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0090, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0090, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0090, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0090, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0089, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0089, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0089, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0089, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0088, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0088, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0088, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0088, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0087, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0087, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0087, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0087, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0086, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0086, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0086, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0086, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0085, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0085, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0085, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0085, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0084, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0084, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0084, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0084, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0084, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0083, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0083, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0083, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0083, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0082, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0082, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0082, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0082, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0082, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0081, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0081, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0081, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0081, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0081, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0080, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0080, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0080, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0080, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0079, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0079, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0079, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0079, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0079, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0078, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0078, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0078, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0078, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0078, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0078, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0077, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0077, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0077, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0077, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0077, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0076, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0076, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0076, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0076, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0076, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0075, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0075, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0075, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0075, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0075, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0075, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0074, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0074, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0074, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0074, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0074, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0073, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0073, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0073, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0073, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0073, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0073, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0072, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0072, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0072, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0072, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0072, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0072, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0071, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0071, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0071, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0071, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0071, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0071, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0070, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0070, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0070, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0070, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0070, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0070, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0070, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0069, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0069, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0069, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0069, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0069, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0069, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0068, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0068, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0068, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0068, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0068, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0068, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0068, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0067, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0067, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0067, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0067, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0067, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0067, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0067, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0066, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0066, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0066, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0066, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0066, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0066, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0066, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0065, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0065, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0065, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0065, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0065, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0065, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0065, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0064, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0064, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0064, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0064, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0064, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0064, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0064, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0064, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0063, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0063, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0063, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0063, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0063, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0063, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0063, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0063, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0062, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0062, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0062, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0062, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0062, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0062, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0062, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0062, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0061, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0061, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0061, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0061, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0061, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0061, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0061, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0061, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0060, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0060, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0060, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0060, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0060, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0060, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0060, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0060, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0060, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0059, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0059, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0059, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0059, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0059, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0059, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0059, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0059, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0059, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0058, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0058, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0058, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0058, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0058, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0058, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0058, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0058, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0058, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0057, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0057, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0057, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0057, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0057, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0057, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0057, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0057, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0057, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0057, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0056, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0056, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0056, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0056, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0056, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0056, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0056, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0056, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0056, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0056, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0055, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0055, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0055, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0055, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0055, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0055, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0055, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0055, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0055, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0055, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0054, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0054, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0054, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0054, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0054, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0054, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0054, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0054, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0054, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0054, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0053, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0053, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0053, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0053, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0053, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0053, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0053, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0053, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0053, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0053, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0053, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0053, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0052, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0052, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0052, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0052, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0052, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0052, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0052, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0052, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0052, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0052, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0052, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0051, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0051, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0051, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0051, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0051, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0051, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0051, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0051, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0051, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0051, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0051, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0051, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0050, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0050, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0050, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0050, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0050, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0050, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0050, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0050, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0050, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0050, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0050, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0050, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0049, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0049, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0049, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0049, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0049, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0049, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0049, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0049, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0049, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0049, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0049, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0049, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0049, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0048, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0048, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0048, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0048, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0048, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0048, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0048, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0048, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0048, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0048, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0048, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0048, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0048, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0048, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0047, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0047, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0047, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0047, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0047, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0047, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0047, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0047, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0047, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0047, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0047, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0047, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0047, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0047, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0046, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0046, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0046, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0046, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0046, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0046, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0046, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0046, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0046, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0046, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0046, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0046, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0046, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0046, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0046, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0045, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0045, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0045, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0045, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0045, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0045, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0045, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0045, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0045, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0045, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0045, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0045, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0045, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0045, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0045, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0044, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0044, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0044, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0044, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0044, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0044, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0044, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0044, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0044, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0044, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0044, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0044, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0044, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0044, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0044, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0044, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0043, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0043, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0043, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0043, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0043, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0043, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0043, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0043, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0043, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0043, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0043, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0043, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0043, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0043, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0043, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0043, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0043, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0042, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0042, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0042, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0042, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0042, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0042, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0042, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0042, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0042, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0042, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0042, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0042, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0042, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0042, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0042, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0042, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0042, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0041, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0041, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0041, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0041, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0041, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0041, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0041, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0041, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0041, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0041, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0041, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0041, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0041, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0041, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0041, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0041, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0041, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0041, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0041, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0040, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0040, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0040, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0040, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0040, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0040, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0040, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0040, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0040, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0040, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0040, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0040, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0040, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0040, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0040, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0040, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0040, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0040, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0040, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0039, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0039, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0039, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0039, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0039, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0039, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0039, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0039, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0039, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0039, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0039, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0039, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0039, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0039, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0039, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0039, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0039, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0039, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0039, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0039, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0034, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(0.0033, device='mps:0', grad_fn=<AddBackward0>)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 170528 characters]",
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "schut_generator = SchutGenerator(model, dataset.input_properties, {\"n_iter\": 1000})\n",
    "schut_generator.setup(X_train, y_train, X_calib, y_calib)\n",
    "scf = schut_generator.generate_counterfactual(factual, y_target)\n",
    "plot_counterfactual(factual, scf, model, X_train, X_test, y_train, y_test, conformal=None)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "ba99294a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "False\n",
      "Epoch 1/50, Loss: 0.3418229103088379\n",
      "Epoch 2/50, Loss: 0.14410137997733222\n",
      "Epoch 3/50, Loss: 0.08232818643252054\n",
      "Epoch 4/50, Loss: 0.07493928008609348\n",
      "Epoch 5/50, Loss: 0.06413143939442105\n",
      "Epoch 6/50, Loss: 0.058354137672318354\n",
      "Epoch 7/50, Loss: 0.058478559056917824\n",
      "Epoch 8/50, Loss: 0.0546965049372779\n",
      "Epoch 9/50, Loss: 0.05659158296055264\n",
      "Epoch 10/50, Loss: 0.054108528130584296\n",
      "Epoch 11/50, Loss: 0.05437907460663054\n",
      "Epoch 12/50, Loss: 0.052927171190579735\n",
      "Epoch 13/50, Loss: 0.05478256675932142\n",
      "Epoch 14/50, Loss: 0.051798995004759894\n",
      "Epoch 15/50, Loss: 0.05211528539657593\n",
      "Epoch 16/50, Loss: 0.05214991999997033\n",
      "Epoch 17/50, Loss: 0.049840710560480755\n",
      "Epoch 18/50, Loss: 0.05059716701507568\n",
      "Epoch 19/50, Loss: 0.04909152653482225\n",
      "Epoch 20/50, Loss: 0.04788659479882982\n",
      "Epoch 21/50, Loss: 0.04865187406539917\n",
      "Epoch 22/50, Loss: 0.049563139014773896\n",
      "Epoch 23/50, Loss: 0.04703254368570116\n",
      "Epoch 24/50, Loss: 0.04830262197388543\n",
      "Epoch 25/50, Loss: 0.04899788614776399\n",
      "Epoch 26/50, Loss: 0.048223164015346105\n",
      "Epoch 27/50, Loss: 0.04630596472157372\n",
      "Epoch 28/50, Loss: 0.04611698091030121\n",
      "Epoch 29/50, Loss: 0.05110915303230286\n",
      "Epoch 30/50, Loss: 0.05125449862745073\n",
      "Epoch 31/50, Loss: 0.04784872796800402\n",
      "Epoch 32/50, Loss: 0.04333643946382734\n",
      "Epoch 33/50, Loss: 0.046047516498300765\n",
      "Epoch 34/50, Loss: 0.04820662604437934\n",
      "Epoch 35/50, Loss: 0.04649613036049737\n",
      "Epoch 36/50, Loss: 0.045152082045873\n",
      "Epoch 37/50, Loss: 0.044245737791061404\n",
      "Epoch 38/50, Loss: 0.04501883238554001\n",
      "Epoch 39/50, Loss: 0.04641288485791948\n",
      "Epoch 40/50, Loss: 0.04480071862538656\n",
      "Epoch 41/50, Loss: 0.044275576869646706\n",
      "Epoch 42/50, Loss: 0.046005213260650636\n",
      "Epoch 43/50, Loss: 0.04339557786782582\n",
      "Epoch 44/50, Loss: 0.04432275361484951\n",
      "Epoch 45/50, Loss: 0.045141037636333044\n",
      "Epoch 46/50, Loss: 0.04354225264655219\n",
      "Epoch 47/50, Loss: 0.043629770477612816\n",
      "Epoch 48/50, Loss: 0.04671833515167236\n",
      "Epoch 49/50, Loss: 0.04344002803166707\n",
      "Epoch 50/50, Loss: 0.04523371441496743\n",
      "tensor(4.4780, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.4780, device='mps:0', grad_fn=<AddBackward0>)\n",
      "Early stopping\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 168544 characters]",
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "revise_generator = ReviseGenerator(model, dataset.input_properties, {}, Path(\"dataset_face\"), use_pregenerated=False)\n",
    "revise_generator.setup(X_train, y_train, X_calib, y_calib)\n",
    "rcf = revise_generator.generate_counterfactual(factual, y_target)\n",
    "plot_counterfactual(factual, rcf, model, X_train, X_test, y_train, y_test, conformal=None)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "dfe0d11b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor(3.7086, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7042, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6998, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6955, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6912, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6869, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6826, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6783, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6741, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6699, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6657, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6615, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6574, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6533, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6503, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6463, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6424, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6385, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6346, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6308, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6271, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6234, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6197, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6161, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6125, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6090, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6056, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6022, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5989, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5816, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5632, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5448, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5264, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5081, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4900, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4721, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4546, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4373, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4205, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4042, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3884, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3732, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3587, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3448, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3318, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3195, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3082, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2978, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2885, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2801, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2729, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2668, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2619, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2581, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2555, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2541, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2538, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2546, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2565, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2594, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3707, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3793, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3882, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3971, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4060, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4149, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4236, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4321, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4399, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4474, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4548, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4622, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4693, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4764, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4832, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4899, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4964, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5027, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5089, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5150, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5209, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5267, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5323, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5379, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5434, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5488, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5540, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5593, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5644, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5694, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5744, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5793, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5840, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5887, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5933, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5977, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6020, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6061, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6100, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6138, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6173, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6206, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6236, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6264, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6289, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6312, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6331, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6347, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6360, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6370, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6377, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6380, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6381, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6378, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6372, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6363, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6350, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6334, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6315, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6292, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6265, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6233, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6197, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6155, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6108, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6053, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5991, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5921, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5841, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5749, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5646, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5530, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5399, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5252, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5089, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4909, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4712, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4500, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4273, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3790, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3543, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3298, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3063, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2843, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2643, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2469, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2322, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2205, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2138, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2117, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2115, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2131, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2163, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2207, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2262, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2326, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2397, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2473, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2552, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2635, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2719, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2803, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2888, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.2972, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3056, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3138, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3219, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3297, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3374, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3446, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3507, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3567, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3626, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3683, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3739, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3793, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3846, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3898, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3948, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.3997, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4045, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4091, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4137, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4181, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4223, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4265, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4305, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4345, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4383, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4420, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4456, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4491, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4525, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4558, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4590, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4622, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4653, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4682, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4712, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4740, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4768, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4795, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4822, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4847, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4873, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4898, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4922, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4946, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4969, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.4992, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5015, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5037, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5059, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5080, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5101, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5122, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5143, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5163, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5183, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5202, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5221, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5240, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5259, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5278, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5296, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5314, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5332, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5350, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5367, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5385, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5402, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5419, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5435, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5452, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5468, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5485, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5501, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5517, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5533, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5548, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5564, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5579, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5595, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5610, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5625, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5640, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5655, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5670, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5684, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5699, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5713, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5728, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5742, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5756, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5770, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5784, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5798, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5811, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5825, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5839, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5852, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5866, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5879, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5892, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5905, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5918, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5932, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5944, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5957, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5970, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5983, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.5996, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6008, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6021, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6046, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6058, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6070, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6082, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6094, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6107, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6119, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6130, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6142, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6154, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6166, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6178, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6189, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6201, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6213, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6224, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6236, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6247, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6258, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6270, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6281, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6292, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6303, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6314, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6325, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6336, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6347, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6358, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6369, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6380, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6391, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6401, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6412, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6423, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6433, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6444, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6454, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6465, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6475, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6486, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6496, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6506, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6517, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6527, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6537, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6547, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6557, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6567, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6578, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6588, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6597, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6607, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6617, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6627, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6637, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6647, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6657, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6666, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6676, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6686, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6695, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6705, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6714, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6724, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6733, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6743, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6752, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6762, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6771, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6780, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6789, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6799, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6808, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6817, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6826, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6835, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6845, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6854, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6863, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6872, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6881, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6890, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6899, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6908, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6916, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6925, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6934, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6943, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6952, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6960, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6969, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6978, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6986, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.6995, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7004, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7012, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7021, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7029, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7038, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7046, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7055, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7063, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7072, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7080, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7088, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7097, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7105, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7113, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7122, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7130, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7138, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7146, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7154, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7163, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7171, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7179, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7187, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7195, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7203, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7211, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7219, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7227, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7235, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7243, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7251, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7259, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7266, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7274, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7282, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7290, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7298, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7306, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7313, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7321, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7329, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7336, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7344, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7352, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7359, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7367, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7374, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7382, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7390, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7397, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7405, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7412, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7420, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7427, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7434, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7442, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7449, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7457, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7464, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7471, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7479, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7486, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7493, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7501, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7508, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7515, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7522, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7529, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7537, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7544, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7551, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7558, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7565, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7572, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7579, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7586, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7594, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7601, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7608, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7615, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7622, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7629, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7635, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7642, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7649, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7656, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7663, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7670, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7677, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7684, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7691, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7697, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7704, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7711, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7718, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7724, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7731, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7738, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7745, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7751, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7758, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7765, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7771, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7778, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7785, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7791, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7798, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7804, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7811, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7818, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7824, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7831, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7837, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7844, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7850, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7857, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7863, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7869, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7876, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7882, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7889, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7895, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7901, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7908, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7914, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7921, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7927, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7933, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7940, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7946, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7952, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7959, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7965, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7972, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7978, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7984, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7991, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.7997, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8003, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8009, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8016, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8022, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8028, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8041, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8047, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8053, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8059, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8066, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8072, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8078, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8084, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8090, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8096, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8103, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8109, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8115, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8121, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8127, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8133, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8139, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8145, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8151, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8157, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8163, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8169, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8175, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8181, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8187, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8193, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8199, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8205, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8211, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8217, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8223, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8229, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8235, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8240, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8246, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8252, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8258, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8264, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8270, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8275, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8281, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8287, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8293, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8299, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8304, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8310, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8316, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8322, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8327, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8333, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8339, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8344, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8350, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8356, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8361, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8367, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8373, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8378, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8384, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8389, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8395, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8401, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8406, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8412, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8417, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8423, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8428, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8434, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8439, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8445, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8450, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8456, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8461, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8467, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8472, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8478, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8483, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8489, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8494, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8499, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8505, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8510, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8516, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8521, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8526, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8532, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8537, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8542, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8548, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8553, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8558, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8564, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8569, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8574, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8579, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8585, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8590, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8595, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8600, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8606, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8611, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8616, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8621, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8627, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8632, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8637, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8642, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8647, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8652, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8658, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8663, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8668, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8673, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8678, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8683, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8688, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8693, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8698, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8703, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8709, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8714, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8719, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8724, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8729, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8734, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8739, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8744, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8749, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8754, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8759, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8764, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8769, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8774, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8779, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8783, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8788, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8793, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8798, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8803, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8808, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8813, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8818, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8823, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8828, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8833, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8837, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8842, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8847, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8852, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8857, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8862, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8866, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8871, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8876, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8881, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8886, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8890, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8895, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8900, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8905, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8909, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8914, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8919, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8924, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8928, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8933, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8938, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8942, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8947, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8952, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8957, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8961, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8966, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8971, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8975, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8980, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8984, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8989, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8994, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.8998, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9003, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9008, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9012, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9017, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9021, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9026, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9031, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9035, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9040, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9044, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9049, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9053, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9058, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9062, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9067, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9071, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9076, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9080, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9085, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9089, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9094, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9098, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9103, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9107, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9112, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9116, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9121, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9125, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9130, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9134, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9138, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9143, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9147, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9152, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9156, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9160, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9165, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9169, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9174, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9178, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9182, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9187, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9191, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9195, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9200, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9204, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9208, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9213, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9217, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9221, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9226, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9230, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9234, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9238, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9243, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9247, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9251, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9255, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9260, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9264, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9268, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9272, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9277, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9281, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9285, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9289, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9294, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9298, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9302, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9306, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9310, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9315, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9319, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9323, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9327, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9331, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9335, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9339, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9344, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9348, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9352, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9356, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9360, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9364, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9368, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9372, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9377, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9381, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9385, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9389, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9393, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9397, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9401, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9405, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9409, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9413, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9417, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9421, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9425, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9429, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9433, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9437, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9441, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9446, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9450, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9454, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9458, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9461, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9465, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9469, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9473, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9477, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9481, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9485, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9489, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9493, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9497, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9501, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9505, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9509, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9513, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9517, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9521, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9525, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9529, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9533, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9536, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9540, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9544, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9548, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9552, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9556, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9560, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9564, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9567, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9571, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9575, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9579, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9583, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9587, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9590, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9594, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9598, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9602, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9606, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9610, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9613, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9617, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9621, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9625, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9629, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9632, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9636, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9640, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9644, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9647, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9651, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9655, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9659, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9662, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9666, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9670, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9674, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9677, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9681, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9685, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9689, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9692, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9696, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9700, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9703, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9707, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9711, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9714, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9718, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9722, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9725, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9729, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9733, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9736, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9740, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9744, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9747, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9751, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9755, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9758, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9762, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9766, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9769, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9773, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9776, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9780, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9784, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9787, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9791, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9794, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9798, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9802, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9805, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9809, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9812, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9816, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9819, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9823, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9827, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9830, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9834, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9837, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9841, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9844, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9848, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9851, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9855, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9858, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9862, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9865, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9869, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9872, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9876, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9879, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9883, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9886, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9890, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9893, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9897, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9900, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9904, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9907, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9911, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9914, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9918, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9921, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9925, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9928, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9931, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9935, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9938, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9942, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9945, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9949, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9952, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9955, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9959, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9962, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9966, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9969, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9972, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9976, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9979, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9983, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9986, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9989, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9993, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9996, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(3.9999, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0003, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0006, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0009, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0013, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0016, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0019, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0023, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0026, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0029, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0033, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0036, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0039, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0043, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0046, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0049, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0053, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0056, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0059, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0062, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0066, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0069, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0072, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0075, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0079, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0082, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0085, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0089, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0092, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0095, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0098, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0101, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0105, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0108, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0111, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0114, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0118, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0121, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0124, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0127, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0130, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0134, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0137, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0140, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0143, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0146, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0150, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0153, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0156, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0159, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0162, device='mps:0', grad_fn=<AddBackward0>)\n",
      "tensor(4.0166, device='mps:0', grad_fn=<AddBackward0>)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 172256 characters]",
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "dcf_gen = DifferentiableCONFEXGenerator(model, dataset.input_properties, {\"conformal_config\": ccf}, None, use_pregenerated=False)\n",
    "dcf_gen.setup(X_train, y_train, X_calib, y_calib)\n",
    "dcf = dcf_gen.generate_counterfactual(factual, y_target)\n",
    "plot_counterfactual(factual, dcf, model, X_train, X_test, y_train, y_test, conformal=None)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "3b142204",
   "metadata": {},
   "outputs": [],
   "source": [
    "ccf\n",
    "ccf['kernel_bandwidth'] = 0.05"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "b3b33f2e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.05 True False\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 97504 characters]",
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "conformal_cfxt = ConformalCONFEXTree(model, dataset.input_properties, ccf)\n",
    "conformal_cfxt.calibrate(X_calib, y_calib, None)\n",
    "plot_conformal_prediction(model, conformal_cfxt, X_calib, X_calib, y_calib, y_calib)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "a8f7cdf4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 173680 characters]",
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_decision_boundary(conformal_cfxt.trees[()], X_train, X_test, y_train, y_test, unary=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "id": "f7b53ad8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'alpha': 0.05,\n",
       " 'scorefn_name': 'linear2',\n",
       " 'kernel_name': 'box_l1',\n",
       " 'kernel_bandwidth': 0.1}"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ccf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "id": "e4a62f14",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.05 True False\n",
      "Set parameter TimeLimit to value 60\n",
      "Gurobi Optimizer version 11.0.3 build v11.0.3rc0 (mac64[arm] - Darwin 23.6.0 23G80)\n",
      "\n",
      "CPU model: Apple M3 Pro\n",
      "Thread count: 12 physical cores, 12 logical processors, using up to 12 threads\n",
      "\n",
      "Academic license 2688232 - for non-commercial use only - registered to am___@kcl.ac.uk\n",
      "Optimize a model with 37 rows, 210 columns and 757 nonzeros\n",
      "Model fingerprint: 0x48428012\n",
      "Model has 3 quadratic constraints\n",
      "Model has 744 general constraints\n",
      "Variable types: 53 continuous, 157 integer (157 binary)\n",
      "Coefficient statistics:\n",
      "  Matrix range     [2e-03, 9e+00]\n",
      "  QMatrix range    [1e+00, 1e+00]\n",
      "  QLMatrix range   [1e+00, 1e+00]\n",
      "  Objective range  [1e+00, 1e+00]\n",
      "  Bounds range     [1e+00, 1e+00]\n",
      "  RHS range        [1e-06, 3e+00]\n",
      "  GenCon rhs range [1e-03, 9e+00]\n",
      "  GenCon coe range [1e+00, 1e+00]\n",
      "Presolve added 112 rows and 28 columns\n",
      "Presolve time: 0.03s\n",
      "Presolved: 149 rows, 238 columns, 1957 nonzeros\n",
      "Presolved model has 94 SOS constraint(s)\n",
      "Variable types: 130 continuous, 108 integer (108 binary)\n",
      "Found heuristic solution: objective 3.1095878\n",
      "Found heuristic solution: objective 3.0645935\n",
      "\n",
      "Root relaxation: objective 7.014006e-01, 36 iterations, 0.00 seconds (0.00 work units)\n",
      "\n",
      "    Nodes    |    Current Node    |     Objective Bounds      |     Work\n",
      " Expl Unexpl |  Obj  Depth IntInf | Incumbent    BestBd   Gap | It/Node Time\n",
      "\n",
      "     0     0    0.70140    0    4    3.06459    0.70140  77.1%     -    0s\n",
      "     0     0    0.70140    0    3    3.06459    0.70140  77.1%     -    0s\n",
      "     0     0    0.70140    0    4    3.06459    0.70140  77.1%     -    0s\n",
      "     0     0    2.38255    0    3    3.06459    2.38255  22.3%     -    0s\n",
      "H    0     0                       2.3849943    2.38255  0.10%     -    0s\n",
      "\n",
      "Cutting planes:\n",
      "  Gomory: 1\n",
      "  Relax-and-lift: 3\n",
      "\n",
      "Explored 1 nodes (67 simplex iterations) in 0.04 seconds (0.05 work units)\n",
      "Thread count was 12 (of 12 available processors)\n",
      "\n",
      "Solution count 3: 2.38499 3.06459 3.10959 \n",
      "\n",
      "Optimal solution found (tolerance 1.00e-04)\n",
      "Best objective 2.384994305808e+00, best bound 2.384994305808e+00, gap 0.0000%\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 75,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 169368 characters]",
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "conformalCF_cfxt = ConformalCF(model, dataset.input_properties, {\"conformal_class\": ConformalCONFEXTree, \"conformal_config\": ccf})\n",
    "conformalCF_cfxt.setup(X_train, y_train, X_calib, y_calib)\n",
    "counterfactual_conformalcfxt = conformalCF_cfxt.generate_counterfactual(factual, y_target)\n",
    "plot_counterfactual(factual, counterfactual_conformalcfxt, model, X_train, X_test, y_train, y_test, conformal=conformalCF_cfxt.conformal)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e7eb8753",
   "metadata": {},
   "outputs": [],
   "source": [
    "conformal = SplitConformalPrediction(model, dataset.input_properties, {\"alpha\": 0.01})\n",
    "conformal.calibrate(X_calib, y_calib)\n",
    "set_size_loss = SetSizeLoss(conformal, T=0.2, kappa=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ac3256a6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor(0.9920, grad_fn=<MaximumBackward0>)"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "opt_state = OptimisationState(model, None, None, torch.tensor([0, -0.5]), torch.tensor(model.predict(np.array([0, -0.5]))), None, None, None, 1, 1)\n",
    "set_size_loss.loss(opt_state)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "25d4e374",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 164960 characters]",
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_loss_with_gradients(model, ClassificationLoss(), X_train, X_test, y_train, y_test, y_target=1)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "73a24a51",
   "metadata": {},
   "outputs": [],
   "source": [
    "ccf2 = ccf\n",
    "ccf2['kernel_bandwidth'] = 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "718181af",
   "metadata": {},
   "outputs": [],
   "source": [
    "conformal = BaseLCP(model, dataset.input_properties, ccf2)\n",
    "conformal.calibrate(X_calib, y_calib, np.array([0, 0]))\n",
    "set_size_loss = SetSizeLossBaseLCP(conformal, T=0.5, kappa=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "227b6bc1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor(1., grad_fn=<MaximumBackward0>)"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "opt_state.x_enc = torch.tensor([1, 8])\n",
    "set_size_loss.loss(opt_state)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8b07c05a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 177732 characters]",
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_loss_with_gradients(model, set_size_loss, X_train, X_calib, y_train, y_calib, step=0.5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "20e98f5b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1.6906318664550781\n"
     ]
    },
    {
     "ename": "KeyboardInterrupt",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m                         Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[19], line 8\u001b[0m\n\u001b[1;32m      6\u001b[0m conformal \u001b[38;5;241m=\u001b[39m BaseLCP(model, dataset\u001b[38;5;241m.\u001b[39minput_properties, ccf)\n\u001b[1;32m      7\u001b[0m \u001b[38;5;28mprint\u001b[39m(conformal\u001b[38;5;241m.\u001b[39mcalibrate(X_calib, y_calib, np\u001b[38;5;241m.\u001b[39marray([\u001b[38;5;241m0\u001b[39m, \u001b[38;5;241m0\u001b[39m])))\n\u001b[0;32m----> 8\u001b[0m \u001b[43mplot_conformal_prediction\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmodel\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mconformal\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mX_calib\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mX_calib\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43my_calib\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43my_calib\u001b[49m\u001b[43m)\u001b[49m\n",
      "File \u001b[0;32m~/CONFEX+/visualisation.py:71\u001b[0m, in \u001b[0;36mplot_conformal_prediction\u001b[0;34m(model, conformal, X_train, X_calib, y_train, y_calib, x_axis_ind, y_axis_ind, faded_background)\u001b[0m\n\u001b[1;32m     68\u001b[0m y_min, y_max \u001b[38;5;241m=\u001b[39m ax\u001b[38;5;241m.\u001b[39mget_ylim()\n\u001b[1;32m     69\u001b[0m xx, yy \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39mmeshgrid(np\u001b[38;5;241m.\u001b[39marange(x_min, x_max, (x_max\u001b[38;5;241m-\u001b[39mx_min)\u001b[38;5;241m/\u001b[39m\u001b[38;5;241m100\u001b[39m), np\u001b[38;5;241m.\u001b[39marange(y_min, y_max, (y_max\u001b[38;5;241m-\u001b[39my_min)\u001b[38;5;241m/\u001b[39m\u001b[38;5;241m100\u001b[39m))\n\u001b[0;32m---> 71\u001b[0m Z \u001b[38;5;241m=\u001b[39m \u001b[43mconformal\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpredict_batch\u001b[49m\u001b[43m(\u001b[49m\u001b[43mnp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mc_\u001b[49m\u001b[43m[\u001b[49m\u001b[43mxx\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mravel\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43myy\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mravel\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m     72\u001b[0m Z \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39marray(\u001b[38;5;28mlist\u001b[39m(\u001b[38;5;28mmap\u001b[39m(\u001b[38;5;28;01mlambda\u001b[39;00m x: \u001b[38;5;28mlen\u001b[39m(x), Z)))\n\u001b[1;32m     73\u001b[0m Z \u001b[38;5;241m=\u001b[39m Z\u001b[38;5;241m.\u001b[39mreshape(xx\u001b[38;5;241m.\u001b[39mshape)\n",
      "File \u001b[0;32m~/CONFEX+/conformal/localised_conformal_baselcp.py:123\u001b[0m, in \u001b[0;36mBaseLCP.predict_batch\u001b[0;34m(self, X)\u001b[0m\n\u001b[1;32m    120\u001b[0m pred_intervals \u001b[38;5;241m=\u001b[39m []\n\u001b[1;32m    122\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mrange\u001b[39m(\u001b[38;5;28mlen\u001b[39m(predictions)):\n\u001b[0;32m--> 123\u001b[0m     \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcalibrate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mX_calib\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mX_calib\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43my_calib\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43my_calib\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtest_point\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mX\u001b[49m\u001b[43m[\u001b[49m\u001b[43mi\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m    124\u001b[0m     pred_interval \u001b[38;5;241m=\u001b[39m []\n\u001b[1;32m    125\u001b[0m     \u001b[38;5;28;01mfor\u001b[39;00m element \u001b[38;5;129;01min\u001b[39;00m y_labels:\n",
      "File \u001b[0;32m~/CONFEX+/conformal/localised_conformal_baselcp.py:96\u001b[0m, in \u001b[0;36mBaseLCP.calibrate\u001b[0;34m(self, X_calib, y_calib, test_point)\u001b[0m\n\u001b[1;32m     93\u001b[0m weights \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39mzeros((calib_len\u001b[38;5;241m+\u001b[39m\u001b[38;5;241m1\u001b[39m,))\n\u001b[1;32m     95\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m j \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mrange\u001b[39m(calib_len):\n\u001b[0;32m---> 96\u001b[0m     weights[j] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkernel\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mX_calib_encoded\u001b[49m\u001b[43m[\u001b[49m\u001b[43mj\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtest_point\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkernel_bandwidth\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkernel_bandwidth_scaling\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mkernel_input_properties\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m     98\u001b[0m weights[calib_len] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mkernel(test_point, test_point, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mkernel_bandwidth \u001b[38;5;241m*\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mkernel_bandwidth_scaling, kernel_input_properties)\n\u001b[1;32m     99\u001b[0m weights \u001b[38;5;241m/\u001b[39m\u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39msum(weights)\n",
      "File \u001b[0;32m~/CONFEX+/conformal/localised_conformal_baselcp.py:38\u001b[0m, in \u001b[0;36mgaussian_kernel\u001b[0;34m(x1, x2, h, input_properties)\u001b[0m\n\u001b[1;32m     37\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;21mgaussian_kernel\u001b[39m(x1, x2, h, input_properties\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m):\n\u001b[0;32m---> 38\u001b[0m     diff \u001b[38;5;241m=\u001b[39m \u001b[43mfeature_distance\u001b[49m\u001b[43m(\u001b[49m\u001b[43mx1\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mx2\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m2\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43minput_properties\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m     39\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m np\u001b[38;5;241m.\u001b[39mexp(\u001b[38;5;241m-\u001b[39m\u001b[38;5;241m1\u001b[39m \u001b[38;5;241m*\u001b[39m diff \u001b[38;5;241m*\u001b[39m diff \u001b[38;5;241m/\u001b[39m (\u001b[38;5;241m2\u001b[39m \u001b[38;5;241m*\u001b[39m h \u001b[38;5;241m*\u001b[39m h))\n",
      "File \u001b[0;32m~/CONFEX+/conformal/localised_conformal_baselcp.py:35\u001b[0m, in \u001b[0;36mfeature_distance\u001b[0;34m(x1, x2, ord, input_properties)\u001b[0m\n\u001b[1;32m     32\u001b[0m     dist_elements[j] \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39msum(group_vals \u001b[38;5;241m==\u001b[39m group_vals_2) \n\u001b[1;32m     33\u001b[0m     j \u001b[38;5;241m+\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;241m1\u001b[39m\n\u001b[0;32m---> 35\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mnp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mlinalg\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mnorm\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdist_elements\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mord\u001b[39;49m\u001b[43m)\u001b[49m\n",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m: "
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 93824 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "ccf = {\"alpha\": 0.05,\n",
    "        \"scorefn_name\":'linear',\n",
    "        \"kernel_name\":'gaussian', \n",
    "        \"kernel_bandwidth\":1}\n",
    "\n",
    "conformal = BaseLCP(model, dataset.input_properties, ccf)\n",
    "print(conformal.calibrate(X_calib, y_calib, np.array([0, 0])))\n",
    "plot_conformal_prediction(model, conformal, X_calib, X_calib, y_calib, y_calib)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "id": "be472af1",
   "metadata": {},
   "outputs": [],
   "source": [
    "from visualisation import plot_lof, plot_impl"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 121,
   "id": "d9ba85c8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 121,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 172956 characters]",
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_lof(20, X_train, X_test, y_train, y_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 118,
   "id": "fcbbabdd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Axes: >"
      ]
     },
     "execution_count": 118,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 161084 characters]",
      "text/plain": [
       "<Figure size 640x480 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_impl(0.5, 0, X_train, X_test, y_train, y_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1054c56e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "confexplus",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.15"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
