title: AttributeError: 'NoneType' object has no attribute 'name' ( related to different tensorflow versions )
body: <p>While running the jupyter notebook online in google colab, no error is coming out, 
  but while running the code in offline mode, it's giving following error. :</p>
  
  <pre><code>---------------------------------------------------------------------------
  AttributeError                            Traceback (most recent call last)
  &lt;ipython-input-30-04f071b889cd&gt; in &lt;module&gt;
        4     start_time = time.time()
        5     x, min_val, info = fmin_l_bfgs_b(evaluator.loss, x.flatten(),
  ----&gt; 6                            fprime=evaluator.grads, maxfun=20)
        7     print(min_val)
        8     end_time = time.time()
  
  ~/anaconda3/lib/python3.7/site-packages/scipy/optimize/lbfgsb.py in fmin_l_bfgs_b(func, x0, fprime, args, approx_grad, bounds, m, factr, pgtol, epsilon, iprint, maxfun, maxiter, disp, callback, maxls)
      197 
      198     res = _minimize_lbfgsb(fun, x0, args=args, jac=jac, bounds=bounds,
  --&gt; 199                            **opts)
      200     d = {'grad': res['jac'],
      201          'task': res['message'],
  
  ~/anaconda3/lib/python3.7/site-packages/scipy/optimize/lbfgsb.py in _minimize_lbfgsb(fun, x0, args, jac, bounds, disp, maxcor, ftol, gtol, eps, maxfun, maxiter, iprint, callback, maxls, **unknown_options)
      333             # until the completion of the current minimization iteration.
      334             # Overwrite f and g:
  --&gt; 335             f, g = func_and_grad(x)
      336         elif task_str.startswith(b'NEW_X'):
      337             # new iteration
  
  ~/anaconda3/lib/python3.7/site-packages/scipy/optimize/lbfgsb.py in func_and_grad(x)
      283     else:
      284         def func_and_grad(x):
  --&gt; 285             f = fun(x, *args)
      286             g = jac(x, *args)
      287             return f, g
  
  ~/anaconda3/lib/python3.7/site-packages/scipy/optimize/optimize.py in function_wrapper(*wrapper_args)
      324     def function_wrapper(*wrapper_args):
      325         ncalls[0] += 1
  --&gt; 326         return function(*(wrapper_args + args))
      327 
      328     return ncalls, function_wrapper
  
  &lt;ipython-input-27-551cb8cb7b3f&gt; in loss(self, x)
        6     def loss(self, x):
        7         assert self.loss_value is None
  ----&gt; 8         loss_value, grad_values = eval_loss_and_grads(x)
        9         self.loss_value = loss_value
       10         self.grad_values = grad_values
  
  &lt;ipython-input-26-8de948cd1256&gt; in eval_loss_and_grads(x)
        1 def eval_loss_and_grads(x):
        2     x = x.reshape((1, height, width, 3))
  ----&gt; 3     outs = f_outputs([x])
        4     loss_value = outs[0]
        5     grad_values = outs[1].flatten().astype('float64')
  
  ~/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/backend.py in __call__(self, inputs)
     3287         feed_symbols != self._feed_symbols or self.fetches != self._fetches or
     3288         session != self._session):
  -&gt; 3289       self._make_callable(feed_arrays, feed_symbols, symbol_vals, session)
     3290 
     3291     fetched = self._callable_fn(*array_vals,
  
  ~/anaconda3/lib/python3.7/site-packages/tensorflow/python/keras/backend.py in _make_callable(self, feed_arrays, feed_symbols, symbol_vals, session)
     3213     # Handle fetches.
     3214     for x in self.outputs + self.fetches:
  -&gt; 3215       callable_opts.fetch.append(x.name)
     3216     # Handle updates.
     3217     callable_opts.target.append(self.updates_op.name)
  
  AttributeError: 'NoneType' object has no attribute 'name'
  </code></pre>
  
  <p><p> In offline mode, following versions of tensoflow and keras respectively : 1.14.0, 2.3.0
  <p> In google colab, following versions of tensoflow and keras respectively : 1.15.0, 2.2.5
  <p>[ Note : i checked the code, and when i ran it on colab, it was working. ]
  <p> The code is :</p>
  
  <pre><code>import time
  for i in range(iterations):
      print('Start of iteration', i)
      start_time = time.time()
      x, min_val, info = fmin_l_bfgs_b(evaluator.loss, x.flatten(),
                             fprime=evaluator.grads, maxfun=20)
      print(min_val)
      end_time = time.time()
      print('Iteration %d completed in %ds' % (i, end_time - start_time))
  </code></pre>