{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Import" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\util\\execution.py:53: UserWarning: Not running on Linux. Determining available cpus for thread can failand be overestimated. Workaround (only if too many cpus are used):`zfit.run.set_n_cpu(your_cpu_number)`\n", " warnings.warn(\"Not running on Linux. Determining available cpus for thread can fail\"\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", "WARNING: The TensorFlow contrib module will not be included in TensorFlow 2.0.\n", "For more information, please see:\n", " * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md\n", " * https://github.com/tensorflow/addons\n", "If you depend on functionality not listed there, please file an issue.\n", "\n" ] } ], "source": [ "import numpy as np\n", "from pdg_const import pdg\n", "import matplotlib\n", "import matplotlib.pyplot as plt\n", "import pickle as pkl\n", "import sys\n", "import time\n", "from helperfunctions import display_time, prepare_plot\n", "import cmath as c\n", "import scipy.integrate as integrate\n", "from scipy.optimize import fminbound\n", "from array import array as arr\n", "import collections\n", "from itertools import compress\n", "import tensorflow as tf\n", "import zfit\n", "from zfit import ztf" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Build model and graphs\n", "## Create graphs" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "def formfactor( q2, subscript): #returns real value\n", " #check if subscript is viable\n", "\n", " if subscript != \"0\" and subscript != \"+\" and subscript != \"T\":\n", " raise ValueError('Wrong subscript entered, choose either 0, + or T')\n", "\n", " #get constants\n", "\n", " mK = ztf.constant(pdg['Ks_M'])\n", " mbstar0 = ztf.constant(pdg[\"mbstar0\"])\n", " mbstar = ztf.constant(pdg[\"mbstar\"])\n", " b0 = ztf.constant(pdg[\"b0\"])\n", " bplus = ztf.constant(pdg[\"bplus\"])\n", " bT = ztf.constant(pdg[\"bT\"])\n", "\n", " mmu = ztf.constant(pdg['muon_M'])\n", " mb = ztf.constant(pdg['bquark_M'])\n", " ms = ztf.constant(pdg['squark_M'])\n", " mB = ztf.constant(pdg['Bplus_M'])\n", "\n", " #N comes from derivation in paper\n", "\n", " N = 3\n", "\n", " #some helperfunctions\n", "\n", " tpos = (mB - mK)**2\n", " tzero = (mB + mK)*(ztf.sqrt(mB)-ztf.sqrt(mK))**2\n", "\n", " z_oben = ztf.sqrt(tpos - q2) - ztf.sqrt(tpos - tzero)\n", " z_unten = ztf.sqrt(tpos - q2) + ztf.sqrt(tpos - tzero)\n", " z = tf.divide(z_oben, z_unten)\n", "\n", " #calculate f0\n", "\n", " if subscript == \"0\":\n", " prefactor = 1/(1 - q2/(mbstar0**2))\n", " _sum = 0\n", "\n", " for i in range(N):\n", " _sum += b0[i]*(tf.pow(z,i))\n", "\n", " return tf.complex(prefactor * _sum, ztf.constant(0.0))\n", "\n", " #calculate f+ or fT\n", "\n", " else:\n", " prefactor = 1/(1 - q2/(mbstar**2))\n", " _sum = 0\n", "\n", " if subscript == \"T\":\n", " b = bT\n", " else:\n", " b = bplus\n", "\n", " for i in range(N):\n", " _sum += b[i] * (tf.pow(z, i) - ((-1)**(i-N)) * (i/N) * tf.pow(z, N))\n", "\n", " return tf.complex(prefactor * _sum, ztf.constant(0.0))\n", "\n", "def resonance(q, _mass, width, phase, scale):\n", "\n", " q2 = tf.pow(q, 2)\n", "\n", " mmu = ztf.constant(pdg['muon_M'])\n", "\n", " p = 0.5 * ztf.sqrt(q2 - 4*(mmu**2))\n", "\n", " p0 = 0.5 * ztf.sqrt(_mass**2 - 4*mmu**2)\n", "\n", " gamma_j = tf.divide(p, q2) * _mass * width / p0\n", "\n", " #Calculate the resonance\n", "\n", " _top = tf.complex(_mass * width, ztf.constant(0.0))\n", "\n", " _bottom = tf.complex(_mass**2 - q2, -_mass*gamma_j)\n", "\n", " com = _top/_bottom\n", "\n", " #Rotate by the phase\n", "\n", " r = tf.abs(com)\n", "\n", " _phase = tf.angle(com)\n", "\n", " _phase += phase\n", "\n", " x = tf.cos(phase)*r\n", " y = tf.sin(phase)*r\n", "\n", " com = tf.complex(scale* x, scale * y)\n", "\n", " return com\n", "\n", "def bifur_gauss(q, mean, sigma_L, sigma_R, scale):\n", "\n", " _exp = tf.where(q < mean, ztf.exp(- tf.pow((q-mean),2) / (2 * sigma_L**2)), ztf.exp(- tf.pow((q-mean),2) / (2 * sigma_R**2)))\n", "\n", " #Scale so the total area under curve is 1 and the top of the cusp is continuous\n", "\n", " dgamma = scale*_exp/(ztf.sqrt(2*np.pi))*2*(sigma_L*sigma_R)/(sigma_L+sigma_R)\n", "\n", " com = ztf.complex(dgamma, ztf.constant(0.0))\n", "\n", " return com\n", "\n", "def axiv_nonres(q):\n", "\n", " GF = ztf.constant(pdg['GF'])\n", " alpha_ew = ztf.constant(pdg['alpha_ew'])\n", " Vtb = ztf.constant(pdg['Vtb'])\n", " Vts = ztf.constant(pdg['Vts'])\n", " C10eff = ztf.constant(pdg['C10eff'])\n", "\n", " mmu = ztf.constant(pdg['muon_M'])\n", " mb = ztf.constant(pdg['bquark_M'])\n", " ms = ztf.constant(pdg['squark_M'])\n", " mK = ztf.constant(pdg['Ks_M'])\n", " mB = ztf.constant(pdg['Bplus_M'])\n", "\n", " q2 = tf.pow(q, 2)\n", "\n", " #Some helperfunctions\n", "\n", " beta = ztf.sqrt(tf.abs(1. - 4. * mmu**2. / q2))\n", "\n", " kabs = ztf.sqrt(mB**2. +tf.pow(q2, 2)/mB**2. + mK**4./mB**2. - 2. * (mB**2. * mK**2. + mK**2. * q2 + mB**2. * q2) / mB**2.)\n", "\n", " #prefactor in front of whole bracket\n", "\n", " prefactor1 = GF**2. *alpha_ew**2. * (tf.abs(Vtb*Vts))**2. * kabs * beta / (128. * np.pi**5.)\n", "\n", " #left term in bracket\n", "\n", " bracket_left = 2./3. * kabs**2. * beta**2. *tf.abs(tf.complex(C10eff, ztf.constant(0.0))*formfactor(q2, \"+\"))**2.\n", "\n", " #middle term in bracket\n", "\n", " _top = 4. * mmu**2. * (mB**2. - mK**2.) * (mB**2. - mK**2.)\n", "\n", " _under = q2 * mB**2.\n", "\n", " bracket_middle = _top/_under *tf.pow(tf.abs(tf.complex(C10eff, ztf.constant(0.0)) * formfactor(q2, \"0\")), 2)\n", "\n", " #Note sqrt(q2) comes from derivation as we use q2 and plot q\n", "\n", " return prefactor1 * (bracket_left + bracket_middle) * 2 *ztf.sqrt(q2)\n", "\n", "def vec(q, funcs):\n", " \n", " q2 = tf.pow(q, 2)\n", "\n", " GF = ztf.constant(pdg['GF'])\n", " alpha_ew = ztf.constant(pdg['alpha_ew'])\n", " Vtb = ztf.constant(pdg['Vtb'])\n", " Vts = ztf.constant(pdg['Vts'])\n", " C7eff = ztf.constant(pdg['C7eff'])\n", "\n", " mmu = ztf.constant(pdg['muon_M'])\n", " mb = ztf.constant(pdg['bquark_M'])\n", " ms = ztf.constant(pdg['squark_M'])\n", " mK = ztf.constant(pdg['Ks_M'])\n", " mB = ztf.constant(pdg['Bplus_M'])\n", "\n", " #Some helperfunctions\n", "\n", " beta = ztf.sqrt(tf.abs(1. - 4. * mmu**2. / q2))\n", "\n", " kabs = ztf.sqrt(mB**2. + tf.pow(q2, 2)/mB**2. + mK**4./mB**2. - 2 * (mB**2 * mK**2 + mK**2 * q2 + mB**2 * q2) / mB**2)\n", "\n", " #prefactor in front of whole bracket\n", "\n", " prefactor1 = GF**2. *alpha_ew**2. * (tf.abs(Vtb*Vts))**2 * kabs * beta / (128. * np.pi**5.)\n", "\n", " #right term in bracket\n", "\n", " prefactor2 = kabs**2 * (1. - 1./3. * beta**2)\n", "\n", " abs_bracket = tf.abs(c9eff(q, funcs) * formfactor(q2, \"+\") + tf.complex(2.0 * C7eff * (mb + ms)/(mB + mK), ztf.constant(0.0)) * formfactor(q2, \"T\"))**2\n", "\n", " bracket_right = prefactor2 * abs_bracket\n", "\n", " #Note sqrt(q2) comes from derivation as we use q2 and plot q\n", "\n", " return prefactor1 * bracket_right * 2 * ztf.sqrt(q2)\n", "\n", "def c9eff(q, funcs):\n", "\n", " C9eff_nr = tf.complex(ztf.constant(pdg['C9eff']), ztf.constant(0.0))\n", "\n", " c9 = C9eff_nr\n", "\n", " c9 = c9 + funcs\n", "\n", " return c9" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Build pdf" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "class total_pdf(zfit.pdf.ZPDF):\n", " _N_OBS = 1 # dimension, can be omitted\n", " _PARAMS = ['jpsi_mass', 'jpsi_scale', 'jpsi_phase', 'jpsi_width',\n", " 'psi2s_mass', 'psi2s_scale', 'psi2s_phase', 'psi2s_width',\n", " 'cusp_mass', 'sigma_L', 'sigma_R', 'cusp_scale'\n", " ] # the name of the parameters\n", "\n", " def _unnormalized_pdf(self, x):\n", "\n", " def jpsi_res(q):\n", " return resonance(q, _mass = self.params['jpsi_mass'], scale = self.params['jpsi_scale'], phase = self.params['jpsi_phase'], width = self.params['jpsi_width'])\n", "\n", " def psi2s_res(q):\n", " return resonance(q, _mass = self.params['psi2s_mass'], scale = self.params['psi2s_scale'], phase = self.params['psi2s_phase'], width = self.params['psi2s_width'])\n", "\n", " def cusp(q):\n", " return bifur_gauss(q, mean = self.params['cusp_mass'], sigma_L = self.params['sigma_L'], sigma_R = self.params['sigma_R'], scale = self.params['cusp_scale'])\n", "\n", " funcs = jpsi_res(x) + psi2s_res(x) + cusp(x)\n", "\n", " vec_f = vec(x, funcs)\n", "\n", " axiv_nr = axiv_nonres(x)\n", "\n", " tot = vec_f + axiv_nr\n", "\n", " return tot" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Load data" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "x_min = 2*pdg['muon_M']\n", "x_max = (pdg[\"Bplus_M\"]-pdg[\"Ks_M\"]-0.1)\n", "\n", "obs = zfit.Space('q', limits = (x_min, x_max))\n", "\n", "with open(r\"./data/slim_points/slim_points_toy_0_range({0}-{1}).pkl\".format(int(x_min), int(x_max)), \"rb\") as input_file:\n", " part_set = pkl.load(input_file)\n", "\n", "x_part = part_set['x_part']\n", "\n", "x_part = x_part.astype('float64')\n", "\n", "data = zfit.data.Data.from_numpy(array=x_part, obs=obs)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Setup parameters" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "WARNING:tensorflow:From c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\ops\\resource_variable_ops.py:435: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.\n", "Instructions for updating:\n", "Colocations handled automatically by placer.\n" ] } ], "source": [ "#jpsi\n", "\n", "jpsi_mass, jpsi_width, jpsi_phase, jpsi_scale = pdg[\"jpsi\"]\n", "\n", "jpsi_m = zfit.Parameter(\"jpsi_m\", ztf.constant(jpsi_mass), floating = False)\n", "jpsi_w = zfit.Parameter(\"jpsi_w\", ztf.constant(jpsi_width), floating = False)\n", "jpsi_p = zfit.Parameter(\"jpsi_p\", ztf.constant(jpsi_phase), floating = False)\n", "jpsi_s = zfit.Parameter(\"jpsi_s\", ztf.constant(jpsi_scale), floating = False)\n", "\n", "#psi2s\n", "\n", "psi2s_mass, psi2s_width, psi2s_phase, psi2s_scale = pdg[\"psi2s\"]\n", "\n", "psi2s_m = zfit.Parameter(\"psi2s_m\", ztf.constant(psi2s_mass), floating = False)\n", "psi2s_w = zfit.Parameter(\"psi2s_w\", ztf.constant(psi2s_width), floating = False)\n", "psi2s_p = zfit.Parameter(\"psi2s_p\", ztf.constant(psi2s_phase), floating = False)\n", "psi2s_s = zfit.Parameter(\"psi2s_s\", ztf.constant(psi2s_scale), floating = False)\n", "\n", "#cusp\n", "\n", "cusp_mass, sigma_R, sigma_L, cusp_scale = 3550, 3e-7, 200, 7\n", "\n", "cusp_m = zfit.Parameter(\"cusp_m\", ztf.constant(cusp_mass))\n", "sig_L = zfit.Parameter(\"sig_L\", ztf.constant(sigma_L))\n", "sig_R = zfit.Parameter(\"sig_R\", ztf.constant(sigma_R))\n", "cusp_s = zfit.Parameter(\"cusp_s\", ztf.constant(cusp_scale))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Test if graphs actually work and compute values" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "def total_test_tf(xq):\n", "\n", " def jpsi_res(q):\n", " return resonance(q, jpsi_m, jpsi_s, jpsi_p, jpsi_w)\n", "\n", " def psi2s_res(q):\n", " return resonance(q, psi2s_m, psi2s_s, psi2s_p, psi2s_w)\n", "\n", " def cusp(q):\n", " return bifur_gauss(q, cusp_m, sig_L, sig_R, cusp_s)\n", "\n", " funcs = jpsi_res(xq) + psi2s_res(xq)# + cusp(xq)\n", "\n", " vec_f = vec(xq, funcs)\n", "\n", " axiv_nr = axiv_nonres(xq)\n", "\n", " tot = vec_f + axiv_nr\n", " \n", " return tot\n", "\n", "calcs = zfit.run(total_test_tf(x_part))\n", "\n", "test_q = np.linspace(x_min, x_max, 1000000)\n", "\n", "calcs_test = zfit.run(total_test_tf(test_q))" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXYAAAEDCAYAAAAhsS8XAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3Xd81dX9x/HXIXuHkJCEBAh7hR0ZYq177wnOqhX3qFZbbW21dvxqW6tttYCKWxyIozhxD5ARVth7hCQkELLJuvf8/sgNUouSwL353vF+Ph555Oaby5fPPXDfOTnf8z3HWGsREZHg0cnpAkRExLsU7CIiQUbBLiISZBTsIiJBRsEuIhJkFOwiI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3zp4DV1tqH9/tWKLZFmqenjjEmBjgBWA18Clzgedp326K1jS4APrEtA6hvAxM9s0V6Af2ABR3zKg6ftfYea222tTaHlvf/J9baSwmxdgAwxsQZYxJaH9Py/3oFHfH+8MHFgtNomR2xEfiV0xcvfHRBZAZQDDTR8tP0GlrGBT8G1ns+p3iea4DHPO1RAOTtd56rgQ2ej6ucfl2H0A5H0fIr4XJgqefjtBBti2HAEk9brAB+4znem5ZA2gC8BkR5jkd7vt7g+X7v/c71K08brQVOdfq1HUabHMO3s2JCrh08r3mZ52Nlax52xPtDSwqIiAQZ3XkqIhJkFOwiIkFGwS4iEmQU7CIiQUbBLiISZBTsIiJBRsEuIhJk/h+viDsvJqipOwAAAABJRU5ErkJggg==\n", "text/plain": [ "<Figure size 432x288 with 1 Axes>" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "# plt.plot(x_part, calcs, '.')\n", "plt.plot(test_q, calcs_test)\n", "# plt.ylim(0, 0.0000007)\n", "# plt.xlim(3000, 3750)\n", "plt.savefig('test.png')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Setup pdf" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "total_f = total_pdf(obs=obs, jpsi_mass = jpsi_m, jpsi_scale = jpsi_s, jpsi_phase = jpsi_p, jpsi_width = jpsi_w,\n", " psi2s_mass = psi2s_m, psi2s_scale = psi2s_s, psi2s_phase = psi2s_p, psi2s_width = psi2s_w,\n", " cusp_mass = cusp_m, sigma_L = sig_L, sigma_R = sig_R, cusp_scale = cusp_s)\n", "\n", "# print(total_pdf.obs)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Sampling\n", "## One sample" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "ename": "ResourceExhaustedError", "evalue": "OOM when allocating tensor with shape[380152,380152] and type bool on /job:localhost/replica:0/task:0/device:CPU:0 by allocator cpu\n\t [[node ZPDF_5/sample/while/Greater_1 (defined at c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\sample.py:154) ]]\nHint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.\n\n\nCaused by op 'ZPDF_5/sample/while/Greater_1', defined at:\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\runpy.py\", line 193, in _run_module_as_main\n \"__main__\", mod_spec)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\runpy.py\", line 85, in _run_code\n exec(code, run_globals)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel_launcher.py\", line 16, in <module>\n app.launch_new_instance()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\traitlets\\config\\application.py\", line 658, in launch_instance\n app.start()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\kernelapp.py\", line 505, in start\n self.io_loop.start()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\platform\\asyncio.py\", line 148, in start\n self.asyncio_loop.run_forever()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\asyncio\\base_events.py\", line 539, in run_forever\n self._run_once()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\asyncio\\base_events.py\", line 1775, in _run_once\n handle._run()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\asyncio\\events.py\", line 88, in _run\n self._context.run(self._callback, *self._args)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\ioloop.py\", line 690, in <lambda>\n lambda f: self._run_callback(functools.partial(callback, future))\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\ioloop.py\", line 743, in _run_callback\n ret = callback()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\gen.py\", line 781, in inner\n self.run()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\gen.py\", line 742, in run\n yielded = self.gen.send(value)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\kernelbase.py\", line 357, in process_one\n yield gen.maybe_future(dispatch(*args))\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\gen.py\", line 209, in wrapper\n yielded = next(result)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\kernelbase.py\", line 267, in dispatch_shell\n yield gen.maybe_future(handler(stream, idents, msg))\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\gen.py\", line 209, in wrapper\n yielded = next(result)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\kernelbase.py\", line 534, in execute_request\n user_expressions, allow_stdin,\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\gen.py\", line 209, in wrapper\n yielded = next(result)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\ipkernel.py\", line 294, in do_execute\n res = shell.run_cell(code, store_history=store_history, silent=silent)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\zmqshell.py\", line 536, in run_cell\n return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 2848, in run_cell\n raw_cell, store_history, silent, shell_futures)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 2874, in _run_cell\n return runner(coro)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\async_helpers.py\", line 67, in _pseudo_sync_runner\n coro.send(None)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 3049, in run_cell_async\n interactivity=interactivity, compiler=compiler, result=result)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 3220, in run_ast_nodes\n if (yield from self.run_code(code, result)):\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 3296, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n File \"<ipython-input-14-8af5da1d0911>\", line 3, in <module>\n total_f.sample(n=nevents)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 871, in sample\n sample = self._single_hook_sample(n=n, limits=limits, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 877, in _single_hook_sample\n return self._hook_sample(n=n, limits=limits, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basepdf.py\", line 489, in _hook_sample\n samples = super()._hook_sample(limits=limits, n=n, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 880, in _hook_sample\n return self._norm_sample(n=n, limits=limits, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 884, in _norm_sample\n return self._limits_sample(n=n, limits=limits, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 887, in _limits_sample\n return self._call_sample(n=n, limits=limits, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 901, in _call_sample\n return self._fallback_sample(n=n, limits=limits)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 934, in _fallback_sample\n sample_and_weights_factory=self._sample_and_weights)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\sample.py\", line 174, in accept_reject_sample\n back_prop=False)[1] # backprop not needed here\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\ops\\control_flow_ops.py\", line 3556, in while_loop\n return_same_structure)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\ops\\control_flow_ops.py\", line 3087, in BuildLoop\n pred, body, original_loop_vars, loop_vars, shape_invariants)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\ops\\control_flow_ops.py\", line 3022, in _BuildLoop\n body_result = body(*packed_vars_for_body)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\sample.py\", line 154, in sample_body\n take_or_not = probabilities > random_thresholds\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\ops\\gen_math_ops.py\", line 3922, in greater\n \"Greater\", x=x, y=y, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\framework\\op_def_library.py\", line 788, in _apply_op_helper\n op_def=op_def)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\util\\deprecation.py\", line 507, in new_func\n return func(*args, **kwargs)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\framework\\ops.py\", line 3300, in create_op\n op_def=op_def)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\framework\\ops.py\", line 1801, in __init__\n self._traceback = tf_stack.extract_stack()\n\nResourceExhaustedError (see above for traceback): OOM when allocating tensor with shape[380152,380152] and type bool on /job:localhost/replica:0/task:0/device:CPU:0 by allocator cpu\n\t [[node ZPDF_5/sample/while/Greater_1 (defined at c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\sample.py:154) ]]\nHint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.\n\n", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mResourceExhaustedError\u001b[0m Traceback (most recent call last)", "\u001b[1;32mc:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\client\\session.py\u001b[0m in \u001b[0;36m_do_call\u001b[1;34m(self, fn, *args)\u001b[0m\n\u001b[0;32m 1333\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 1334\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mfn\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m*\u001b[0m\u001b[0margs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 1335\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0merrors\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mOpError\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32mc:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\client\\session.py\u001b[0m in \u001b[0;36m_run_fn\u001b[1;34m(feed_dict, fetch_list, target_list, options, run_metadata)\u001b[0m\n\u001b[0;32m 1318\u001b[0m return self._call_tf_sessionrun(\n\u001b[1;32m-> 1319\u001b[1;33m options, feed_dict, fetch_list, target_list, run_metadata)\n\u001b[0m\u001b[0;32m 1320\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32mc:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\client\\session.py\u001b[0m in \u001b[0;36m_call_tf_sessionrun\u001b[1;34m(self, options, feed_dict, fetch_list, target_list, run_metadata)\u001b[0m\n\u001b[0;32m 1406\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_session\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0moptions\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfeed_dict\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfetch_list\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mtarget_list\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 1407\u001b[1;33m run_metadata)\n\u001b[0m\u001b[0;32m 1408\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;31mResourceExhaustedError\u001b[0m: OOM when allocating tensor with shape[380152,380152] and type bool on /job:localhost/replica:0/task:0/device:CPU:0 by allocator cpu\n\t [[{{node ZPDF_5/sample/while/Greater_1}}]]\nHint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.\n", "\nDuring handling of the above exception, another exception occurred:\n", "\u001b[1;31mResourceExhaustedError\u001b[0m Traceback (most recent call last)", "\u001b[1;32m<ipython-input-14-8af5da1d0911>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[0mnevents\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m1000\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[0mtotal_f\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msample\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mn\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mnevents\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[1;32mc:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\u001b[0m in \u001b[0;36msample\u001b[1;34m(self, n, limits, name)\u001b[0m\n\u001b[0;32m 870\u001b[0m \u001b[0mlimits\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_check_input_limits\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlimits\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mlimits\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcaller_name\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mname\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mnone_is_error\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mTrue\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 871\u001b[0m \u001b[0msample\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_single_hook_sample\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mn\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mn\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mlimits\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mlimits\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mname\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mname\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 872\u001b[1;33m \u001b[0msample_data\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mSampleData\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mfrom_sample\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msample\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0msample\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mobs\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mspace\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 873\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 874\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0msample_data\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32mc:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\data.py\u001b[0m in \u001b[0;36mfrom_sample\u001b[1;34m(cls, sample, obs, name, weights)\u001b[0m\n\u001b[0;32m 528\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mfrom_sample\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mcls\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0msample\u001b[0m\u001b[1;33m:\u001b[0m \u001b[0mtf\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mTensor\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mobs\u001b[0m\u001b[1;33m:\u001b[0m \u001b[0mztyping\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mObsTypeInput\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mname\u001b[0m\u001b[1;33m:\u001b[0m \u001b[0mstr\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mweights\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mNone\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 529\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mzfit\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 530\u001b[1;33m \u001b[0msample\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mzfit\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msample\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 531\u001b[0m sample_holder = tf.Variable(initial_value=sample, trainable=False, collections=(\"zfit_sample_cache\",),\n\u001b[0;32m 532\u001b[0m \u001b[0mname\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m\"sample_data_holder_{}\"\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mcls\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_cache_counting\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32mc:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\util\\execution.py\u001b[0m in \u001b[0;36m__call__\u001b[1;34m(self, *args, **kwargs)\u001b[0m\n\u001b[0;32m 75\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 76\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0m__call__\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m*\u001b[0m\u001b[0margs\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 77\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msess\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m*\u001b[0m\u001b[0margs\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 78\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 79\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mcreate_session\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m*\u001b[0m\u001b[0margs\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32mc:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\client\\session.py\u001b[0m in \u001b[0;36mrun\u001b[1;34m(self, fetches, feed_dict, options, run_metadata)\u001b[0m\n\u001b[0;32m 927\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 928\u001b[0m result = self._run(None, fetches, feed_dict, options_ptr,\n\u001b[1;32m--> 929\u001b[1;33m run_metadata_ptr)\n\u001b[0m\u001b[0;32m 930\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mrun_metadata\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 931\u001b[0m \u001b[0mproto_data\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mtf_session\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mTF_GetBuffer\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mrun_metadata_ptr\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32mc:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\client\\session.py\u001b[0m in \u001b[0;36m_run\u001b[1;34m(self, handle, fetches, feed_dict, options, run_metadata)\u001b[0m\n\u001b[0;32m 1150\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mfinal_fetches\u001b[0m \u001b[1;32mor\u001b[0m \u001b[0mfinal_targets\u001b[0m \u001b[1;32mor\u001b[0m \u001b[1;33m(\u001b[0m\u001b[0mhandle\u001b[0m \u001b[1;32mand\u001b[0m \u001b[0mfeed_dict_tensor\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1151\u001b[0m results = self._do_run(handle, final_targets, final_fetches,\n\u001b[1;32m-> 1152\u001b[1;33m feed_dict_tensor, options, run_metadata)\n\u001b[0m\u001b[0;32m 1153\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1154\u001b[0m \u001b[0mresults\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32mc:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\client\\session.py\u001b[0m in \u001b[0;36m_do_run\u001b[1;34m(self, handle, target_list, fetch_list, feed_dict, options, run_metadata)\u001b[0m\n\u001b[0;32m 1326\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mhandle\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1327\u001b[0m return self._do_call(_run_fn, feeds, fetches, targets, options,\n\u001b[1;32m-> 1328\u001b[1;33m run_metadata)\n\u001b[0m\u001b[0;32m 1329\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1330\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_do_call\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0m_prun_fn\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mhandle\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfeeds\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfetches\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32mc:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\client\\session.py\u001b[0m in \u001b[0;36m_do_call\u001b[1;34m(self, fn, *args)\u001b[0m\n\u001b[0;32m 1346\u001b[0m \u001b[1;32mpass\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1347\u001b[0m \u001b[0mmessage\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0merror_interpolation\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0minterpolate\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_graph\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 1348\u001b[1;33m \u001b[1;32mraise\u001b[0m \u001b[0mtype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0me\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnode_def\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mop\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mmessage\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 1349\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1350\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0m_extend_graph\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;31mResourceExhaustedError\u001b[0m: OOM when allocating tensor with shape[380152,380152] and type bool on /job:localhost/replica:0/task:0/device:CPU:0 by allocator cpu\n\t [[node ZPDF_5/sample/while/Greater_1 (defined at c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\sample.py:154) ]]\nHint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.\n\n\nCaused by op 'ZPDF_5/sample/while/Greater_1', defined at:\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\runpy.py\", line 193, in _run_module_as_main\n \"__main__\", mod_spec)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\runpy.py\", line 85, in _run_code\n exec(code, run_globals)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel_launcher.py\", line 16, in <module>\n app.launch_new_instance()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\traitlets\\config\\application.py\", line 658, in launch_instance\n app.start()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\kernelapp.py\", line 505, in start\n self.io_loop.start()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\platform\\asyncio.py\", line 148, in start\n self.asyncio_loop.run_forever()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\asyncio\\base_events.py\", line 539, in run_forever\n self._run_once()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\asyncio\\base_events.py\", line 1775, in _run_once\n handle._run()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\asyncio\\events.py\", line 88, in _run\n self._context.run(self._callback, *self._args)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\ioloop.py\", line 690, in <lambda>\n lambda f: self._run_callback(functools.partial(callback, future))\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\ioloop.py\", line 743, in _run_callback\n ret = callback()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\gen.py\", line 781, in inner\n self.run()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\gen.py\", line 742, in run\n yielded = self.gen.send(value)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\kernelbase.py\", line 357, in process_one\n yield gen.maybe_future(dispatch(*args))\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\gen.py\", line 209, in wrapper\n yielded = next(result)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\kernelbase.py\", line 267, in dispatch_shell\n yield gen.maybe_future(handler(stream, idents, msg))\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\gen.py\", line 209, in wrapper\n yielded = next(result)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\kernelbase.py\", line 534, in execute_request\n user_expressions, allow_stdin,\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\gen.py\", line 209, in wrapper\n yielded = next(result)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\ipkernel.py\", line 294, in do_execute\n res = shell.run_cell(code, store_history=store_history, silent=silent)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\zmqshell.py\", line 536, in run_cell\n return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 2848, in run_cell\n raw_cell, store_history, silent, shell_futures)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 2874, in _run_cell\n return runner(coro)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\async_helpers.py\", line 67, in _pseudo_sync_runner\n coro.send(None)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 3049, in run_cell_async\n interactivity=interactivity, compiler=compiler, result=result)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 3220, in run_ast_nodes\n if (yield from self.run_code(code, result)):\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 3296, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n File \"<ipython-input-14-8af5da1d0911>\", line 3, in <module>\n total_f.sample(n=nevents)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 871, in sample\n sample = self._single_hook_sample(n=n, limits=limits, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 877, in _single_hook_sample\n return self._hook_sample(n=n, limits=limits, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basepdf.py\", line 489, in _hook_sample\n samples = super()._hook_sample(limits=limits, n=n, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 880, in _hook_sample\n return self._norm_sample(n=n, limits=limits, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 884, in _norm_sample\n return self._limits_sample(n=n, limits=limits, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 887, in _limits_sample\n return self._call_sample(n=n, limits=limits, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 901, in _call_sample\n return self._fallback_sample(n=n, limits=limits)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 934, in _fallback_sample\n sample_and_weights_factory=self._sample_and_weights)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\sample.py\", line 174, in accept_reject_sample\n back_prop=False)[1] # backprop not needed here\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\ops\\control_flow_ops.py\", line 3556, in while_loop\n return_same_structure)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\ops\\control_flow_ops.py\", line 3087, in BuildLoop\n pred, body, original_loop_vars, loop_vars, shape_invariants)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\ops\\control_flow_ops.py\", line 3022, in _BuildLoop\n body_result = body(*packed_vars_for_body)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\sample.py\", line 154, in sample_body\n take_or_not = probabilities > random_thresholds\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\ops\\gen_math_ops.py\", line 3922, in greater\n \"Greater\", x=x, y=y, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\framework\\op_def_library.py\", line 788, in _apply_op_helper\n op_def=op_def)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\util\\deprecation.py\", line 507, in new_func\n return func(*args, **kwargs)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\framework\\ops.py\", line 3300, in create_op\n op_def=op_def)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\framework\\ops.py\", line 1801, in __init__\n self._traceback = tf_stack.extract_stack()\n\nResourceExhaustedError (see above for traceback): OOM when allocating tensor with shape[380152,380152] and type bool on /job:localhost/replica:0/task:0/device:CPU:0 by allocator cpu\n\t [[node ZPDF_5/sample/while/Greater_1 (defined at c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\sample.py:154) ]]\nHint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.\n\n" ] } ], "source": [ "nevents = 1000\n", "\n", "total_f.sample(n=nevents)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Toys" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "ename": "ResourceExhaustedError", "evalue": "OOM when allocating tensor with shape[500000,500000] and type bool on /job:localhost/replica:0/task:0/device:CPU:0 by allocator cpu\n\t [[node ZPDF_4/create_sampler/while/Greater_1 (defined at c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\sample.py:154) ]]\nHint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.\n\n\nCaused by op 'ZPDF_4/create_sampler/while/Greater_1', defined at:\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\runpy.py\", line 193, in _run_module_as_main\n \"__main__\", mod_spec)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\runpy.py\", line 85, in _run_code\n exec(code, run_globals)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel_launcher.py\", line 16, in <module>\n app.launch_new_instance()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\traitlets\\config\\application.py\", line 658, in launch_instance\n app.start()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\kernelapp.py\", line 505, in start\n self.io_loop.start()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\platform\\asyncio.py\", line 148, in start\n self.asyncio_loop.run_forever()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\asyncio\\base_events.py\", line 539, in run_forever\n self._run_once()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\asyncio\\base_events.py\", line 1775, in _run_once\n handle._run()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\asyncio\\events.py\", line 88, in _run\n self._context.run(self._callback, *self._args)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\ioloop.py\", line 690, in <lambda>\n lambda f: self._run_callback(functools.partial(callback, future))\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\ioloop.py\", line 743, in _run_callback\n ret = callback()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\gen.py\", line 781, in inner\n self.run()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\gen.py\", line 742, in run\n yielded = self.gen.send(value)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\kernelbase.py\", line 357, in process_one\n yield gen.maybe_future(dispatch(*args))\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\gen.py\", line 209, in wrapper\n yielded = next(result)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\kernelbase.py\", line 267, in dispatch_shell\n yield gen.maybe_future(handler(stream, idents, msg))\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\gen.py\", line 209, in wrapper\n yielded = next(result)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\kernelbase.py\", line 534, in execute_request\n user_expressions, allow_stdin,\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\gen.py\", line 209, in wrapper\n yielded = next(result)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\ipkernel.py\", line 294, in do_execute\n res = shell.run_cell(code, store_history=store_history, silent=silent)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\zmqshell.py\", line 536, in run_cell\n return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 2848, in run_cell\n raw_cell, store_history, silent, shell_futures)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 2874, in _run_cell\n return runner(coro)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\async_helpers.py\", line 67, in _pseudo_sync_runner\n coro.send(None)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 3049, in run_cell_async\n interactivity=interactivity, compiler=compiler, result=result)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 3214, in run_ast_nodes\n if (yield from self.run_code(code, result)):\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 3296, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n File \"<ipython-input-13-bb295d251023>\", line 1, in <module>\n sampler = total_f.create_sampler(n=nevents)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 814, in create_sampler\n limits=limits, n=n, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 835, in _create_sampler_tensor\n sample = self._single_hook_sample(n=n, limits=limits, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 877, in _single_hook_sample\n return self._hook_sample(n=n, limits=limits, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basepdf.py\", line 489, in _hook_sample\n samples = super()._hook_sample(limits=limits, n=n, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 880, in _hook_sample\n return self._norm_sample(n=n, limits=limits, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 884, in _norm_sample\n return self._limits_sample(n=n, limits=limits, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 887, in _limits_sample\n return self._call_sample(n=n, limits=limits, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 901, in _call_sample\n return self._fallback_sample(n=n, limits=limits)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 934, in _fallback_sample\n sample_and_weights_factory=self._sample_and_weights)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\sample.py\", line 174, in accept_reject_sample\n back_prop=False)[1] # backprop not needed here\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\ops\\control_flow_ops.py\", line 3556, in while_loop\n return_same_structure)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\ops\\control_flow_ops.py\", line 3087, in BuildLoop\n pred, body, original_loop_vars, loop_vars, shape_invariants)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\ops\\control_flow_ops.py\", line 3022, in _BuildLoop\n body_result = body(*packed_vars_for_body)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\sample.py\", line 154, in sample_body\n take_or_not = probabilities > random_thresholds\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\ops\\gen_math_ops.py\", line 3922, in greater\n \"Greater\", x=x, y=y, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\framework\\op_def_library.py\", line 788, in _apply_op_helper\n op_def=op_def)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\util\\deprecation.py\", line 507, in new_func\n return func(*args, **kwargs)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\framework\\ops.py\", line 3300, in create_op\n op_def=op_def)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\framework\\ops.py\", line 1801, in __init__\n self._traceback = tf_stack.extract_stack()\n\nResourceExhaustedError (see above for traceback): OOM when allocating tensor with shape[500000,500000] and type bool on /job:localhost/replica:0/task:0/device:CPU:0 by allocator cpu\n\t [[node ZPDF_4/create_sampler/while/Greater_1 (defined at c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\sample.py:154) ]]\nHint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.\n\n", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mResourceExhaustedError\u001b[0m Traceback (most recent call last)", "\u001b[1;32mc:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\client\\session.py\u001b[0m in \u001b[0;36m_do_call\u001b[1;34m(self, fn, *args)\u001b[0m\n\u001b[0;32m 1333\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 1334\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mfn\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m*\u001b[0m\u001b[0margs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 1335\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0merrors\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mOpError\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32mc:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\client\\session.py\u001b[0m in \u001b[0;36m_run_fn\u001b[1;34m(feed_dict, fetch_list, target_list, options, run_metadata)\u001b[0m\n\u001b[0;32m 1318\u001b[0m return self._call_tf_sessionrun(\n\u001b[1;32m-> 1319\u001b[1;33m options, feed_dict, fetch_list, target_list, run_metadata)\n\u001b[0m\u001b[0;32m 1320\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32mc:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\client\\session.py\u001b[0m in \u001b[0;36m_call_tf_sessionrun\u001b[1;34m(self, options, feed_dict, fetch_list, target_list, run_metadata)\u001b[0m\n\u001b[0;32m 1406\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_session\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0moptions\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfeed_dict\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfetch_list\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mtarget_list\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 1407\u001b[1;33m run_metadata)\n\u001b[0m\u001b[0;32m 1408\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;31mResourceExhaustedError\u001b[0m: OOM when allocating tensor with shape[500000,500000] and type bool on /job:localhost/replica:0/task:0/device:CPU:0 by allocator cpu\n\t [[{{node ZPDF_4/create_sampler/while/Greater_1}}]]\nHint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.\n", "\nDuring handling of the above exception, another exception occurred:\n", "\u001b[1;31mResourceExhaustedError\u001b[0m Traceback (most recent call last)", "\u001b[1;32m<ipython-input-13-bb295d251023>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;31m# param.set_value(initial_value)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 6\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 7\u001b[1;33m \u001b[0msampler\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mresample\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mn\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mnevents\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 8\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 9\u001b[0m \u001b[1;31m# Randomise initial values\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32mc:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\data.py\u001b[0m in \u001b[0;36mresample\u001b[1;34m(self, param_values, n)\u001b[0m\n\u001b[0;32m 624\u001b[0m \u001b[1;32mraise\u001b[0m \u001b[0mRuntimeError\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"Cannot set a new `n` if not a Tensor-like object was given\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 625\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mn_samples\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mload\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mvalue\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mn\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0msession\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msess\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 626\u001b[1;33m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msess\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msample_holder\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0minitializer\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 627\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_initial_resampled\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;32mTrue\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 628\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32mc:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\client\\session.py\u001b[0m in \u001b[0;36mrun\u001b[1;34m(self, fetches, feed_dict, options, run_metadata)\u001b[0m\n\u001b[0;32m 927\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 928\u001b[0m result = self._run(None, fetches, feed_dict, options_ptr,\n\u001b[1;32m--> 929\u001b[1;33m run_metadata_ptr)\n\u001b[0m\u001b[0;32m 930\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mrun_metadata\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 931\u001b[0m \u001b[0mproto_data\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mtf_session\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mTF_GetBuffer\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mrun_metadata_ptr\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32mc:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\client\\session.py\u001b[0m in \u001b[0;36m_run\u001b[1;34m(self, handle, fetches, feed_dict, options, run_metadata)\u001b[0m\n\u001b[0;32m 1150\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mfinal_fetches\u001b[0m \u001b[1;32mor\u001b[0m \u001b[0mfinal_targets\u001b[0m \u001b[1;32mor\u001b[0m \u001b[1;33m(\u001b[0m\u001b[0mhandle\u001b[0m \u001b[1;32mand\u001b[0m \u001b[0mfeed_dict_tensor\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1151\u001b[0m results = self._do_run(handle, final_targets, final_fetches,\n\u001b[1;32m-> 1152\u001b[1;33m feed_dict_tensor, options, run_metadata)\n\u001b[0m\u001b[0;32m 1153\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1154\u001b[0m \u001b[0mresults\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32mc:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\client\\session.py\u001b[0m in \u001b[0;36m_do_run\u001b[1;34m(self, handle, target_list, fetch_list, feed_dict, options, run_metadata)\u001b[0m\n\u001b[0;32m 1326\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mhandle\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1327\u001b[0m return self._do_call(_run_fn, feeds, fetches, targets, options,\n\u001b[1;32m-> 1328\u001b[1;33m run_metadata)\n\u001b[0m\u001b[0;32m 1329\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1330\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_do_call\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0m_prun_fn\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mhandle\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfeeds\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfetches\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;32mc:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\client\\session.py\u001b[0m in \u001b[0;36m_do_call\u001b[1;34m(self, fn, *args)\u001b[0m\n\u001b[0;32m 1346\u001b[0m \u001b[1;32mpass\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1347\u001b[0m \u001b[0mmessage\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0merror_interpolation\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0minterpolate\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_graph\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 1348\u001b[1;33m \u001b[1;32mraise\u001b[0m \u001b[0mtype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0me\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mnode_def\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mop\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mmessage\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 1349\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 1350\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0m_extend_graph\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;31mResourceExhaustedError\u001b[0m: OOM when allocating tensor with shape[500000,500000] and type bool on /job:localhost/replica:0/task:0/device:CPU:0 by allocator cpu\n\t [[node ZPDF_4/create_sampler/while/Greater_1 (defined at c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\sample.py:154) ]]\nHint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.\n\n\nCaused by op 'ZPDF_4/create_sampler/while/Greater_1', defined at:\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\runpy.py\", line 193, in _run_module_as_main\n \"__main__\", mod_spec)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\runpy.py\", line 85, in _run_code\n exec(code, run_globals)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel_launcher.py\", line 16, in <module>\n app.launch_new_instance()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\traitlets\\config\\application.py\", line 658, in launch_instance\n app.start()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\kernelapp.py\", line 505, in start\n self.io_loop.start()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\platform\\asyncio.py\", line 148, in start\n self.asyncio_loop.run_forever()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\asyncio\\base_events.py\", line 539, in run_forever\n self._run_once()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\asyncio\\base_events.py\", line 1775, in _run_once\n handle._run()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\asyncio\\events.py\", line 88, in _run\n self._context.run(self._callback, *self._args)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\ioloop.py\", line 690, in <lambda>\n lambda f: self._run_callback(functools.partial(callback, future))\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\ioloop.py\", line 743, in _run_callback\n ret = callback()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\gen.py\", line 781, in inner\n self.run()\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\gen.py\", line 742, in run\n yielded = self.gen.send(value)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\kernelbase.py\", line 357, in process_one\n yield gen.maybe_future(dispatch(*args))\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\gen.py\", line 209, in wrapper\n yielded = next(result)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\kernelbase.py\", line 267, in dispatch_shell\n yield gen.maybe_future(handler(stream, idents, msg))\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\gen.py\", line 209, in wrapper\n yielded = next(result)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\kernelbase.py\", line 534, in execute_request\n user_expressions, allow_stdin,\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tornado\\gen.py\", line 209, in wrapper\n yielded = next(result)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\ipkernel.py\", line 294, in do_execute\n res = shell.run_cell(code, store_history=store_history, silent=silent)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\ipykernel\\zmqshell.py\", line 536, in run_cell\n return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 2848, in run_cell\n raw_cell, store_history, silent, shell_futures)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 2874, in _run_cell\n return runner(coro)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\async_helpers.py\", line 67, in _pseudo_sync_runner\n coro.send(None)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 3049, in run_cell_async\n interactivity=interactivity, compiler=compiler, result=result)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 3214, in run_ast_nodes\n if (yield from self.run_code(code, result)):\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\IPython\\core\\interactiveshell.py\", line 3296, in run_code\n exec(code_obj, self.user_global_ns, self.user_ns)\n File \"<ipython-input-13-bb295d251023>\", line 1, in <module>\n sampler = total_f.create_sampler(n=nevents)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 814, in create_sampler\n limits=limits, n=n, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 835, in _create_sampler_tensor\n sample = self._single_hook_sample(n=n, limits=limits, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 877, in _single_hook_sample\n return self._hook_sample(n=n, limits=limits, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basepdf.py\", line 489, in _hook_sample\n samples = super()._hook_sample(limits=limits, n=n, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 880, in _hook_sample\n return self._norm_sample(n=n, limits=limits, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 884, in _norm_sample\n return self._limits_sample(n=n, limits=limits, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 887, in _limits_sample\n return self._call_sample(n=n, limits=limits, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 901, in _call_sample\n return self._fallback_sample(n=n, limits=limits)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\basemodel.py\", line 934, in _fallback_sample\n sample_and_weights_factory=self._sample_and_weights)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\sample.py\", line 174, in accept_reject_sample\n back_prop=False)[1] # backprop not needed here\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\ops\\control_flow_ops.py\", line 3556, in while_loop\n return_same_structure)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\ops\\control_flow_ops.py\", line 3087, in BuildLoop\n pred, body, original_loop_vars, loop_vars, shape_invariants)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\ops\\control_flow_ops.py\", line 3022, in _BuildLoop\n body_result = body(*packed_vars_for_body)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\sample.py\", line 154, in sample_body\n take_or_not = probabilities > random_thresholds\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\ops\\gen_math_ops.py\", line 3922, in greater\n \"Greater\", x=x, y=y, name=name)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\framework\\op_def_library.py\", line 788, in _apply_op_helper\n op_def=op_def)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\util\\deprecation.py\", line 507, in new_func\n return func(*args, **kwargs)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\framework\\ops.py\", line 3300, in create_op\n op_def=op_def)\n File \"c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\tensorflow\\python\\framework\\ops.py\", line 1801, in __init__\n self._traceback = tf_stack.extract_stack()\n\nResourceExhaustedError (see above for traceback): OOM when allocating tensor with shape[500000,500000] and type bool on /job:localhost/replica:0/task:0/device:CPU:0 by allocator cpu\n\t [[node ZPDF_4/create_sampler/while/Greater_1 (defined at c:\\users\\sa_li\\.conda\\envs\\rmd\\lib\\site-packages\\zfit\\core\\sample.py:154) ]]\nHint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.\n\n" ] } ], "source": [ "sampler = total_f.create_sampler(n=nevents)\n", "nll = zfit.loss.UnbinnedNLL(model=total_f, data=sampler, fit_range = (x_min, x_max))\n", "\n", "# for param in pdf.get_dependents():\n", "# param.set_value(initial_value)\n", "\n", "sampler.resample(n=nevents)\n", "\n", "# Randomise initial values\n", "# for param in pdf.get_dependents():\n", "# param.set_value(random value here)\n", "\n", "# Minimise the NLL\n", "minimizer = zfit.minimize.MinuitMinimizer()\n", "minimum = minimizer.minimize(nll)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Fitting" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "nll = zfit.loss.UnbinnedNLL(model=total_f, data=data, fit_range = (x_min, x_max))\n", "\n", "minimizer = zfit.minimize.MinuitMinimizer()\n", "# minimizer._use_tfgrad = False\n", "result = minimizer.minimize(nll)\n", "\n", "param_errors = result.error()\n", "\n", "for var, errors in param_errors.items():\n", " print('{}: ^{{+{}}}_{{{}}}'.format(var.name, errors['upper'], errors['lower']))\n", "\n", "print(\"Function minimum:\", result.fmin)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.7.3" } }, "nbformat": 4, "nbformat_minor": 2 }