• Register
0 votes
79 views

Problem :

I am currently working on the TensorFlow that uses very "weird" format of uploading the data. I am trying to to use the NumPy or pandas format for the data to be uploaded, to compare it with scikit-learn results.Also I am getting the digit recognition data from the Kaggle.

But facing following error:

---------------------------------------------------------------------------

FailedPreconditionError                   Traceback (most recent call last)
<ipython-input-82-967faab7d494> in <module>()
      7     Target_batch = np.array(OHTarget[i*50:i*50+50].values)
      8     Target_batch = np.multiply(Target_batch, 1.0 / 255.0)
----> 9     train_step.run(feed_dict={x: batch, y_: Target_batch})
/Users/alecxe/anaconda/lib/python2.7/site-packages/tensorflow/python/framework/ops.pyc in run(self, feed_dict, session)
   2265   none, the default session will be used.
   2266     """
-> 2267  _run_using_default_session(self, feed_dict, self.graph, session)
   2268
   2269
/Users/alecxe/anaconda/lib/python2.7/site-packages/tensorflow/python/framework/ops.pyc in _run_using_default_session(operation, feed_dict, graph, session)
   3761   "the operation's graph is different from the session's "
   3762   "graph.")
-> 3763   session.run(operation, feed_dict)
   3764
   3765
/Users/alecxe/anaconda/lib/python2.7/site-packages/tensorflow/python/client/session.pyc in run(self, fetches, feed_dict)
    443
    444     # Run request and get response.
--> 445     results = self._do_run(target_list, unique_fetch_targets, feed_dict_string)
    446
    447     # User may have fetched the same tensor multiple times, but we
/Users/alecxe/anaconda/lib/python2.7/site-packages/tensorflow/python/client/session.pyc in _do_run(self, target_list, fetch_list, feed_dict)
    517      # pylint: disable=protected-access
    518      raise errors._make_specific_exception(node_def, op, e.error_message,
--> 519                                               e.code)
    520     # pylint: enable=protected-access
    521    raise e_type, e_value, e_traceback
FailedPreconditionError: Attempting to use uninitialized value Variable_1
     [[Node: gradients/add_grad/Shape_1 = Shape[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/cpu:0"](Variable_1)]]
6 5 3
7,540 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

Please note the tf.initialize_all_variables() is currently deprecated. So please initialize the tensorflow variables with following code:

tf.global_variables_initializer()

Please find following the sample usage is:

with tf.Session() as sess:

sess.run(tf.global_variables_initializer())

It will surely solve your issue.

9 7 4
38,600 points

Related questions

1 vote
2 answers 377 views
377 views
Anyone aware of this error. I am facing this issue in this function. It is not going to IF statement where I put my filter condition which is true then simply raise Error and without IF it is working but I want to put the filter condition which checks date between ... "value"]) It is not going to IF statement where I put my filter condition which is true then simply raise Error. Any suggestion?
asked May 8, 2020 Kashish
1 vote
2 answers 1.1K views
1.1K views
Problem : I am receiveing error as the truth value of a dataframe is ambiguous. use a.empty, a.bool(), a.item(), a.any() or a.all().
asked Nov 11, 2019 peterlaw 6.9k points
0 votes
2 answers 1.1K views
1.1K views
Problem : I am new to RandomForest model. While predicting my test data using the RandomForest model I am often facing below ValueError. &ldquo;Input contains nan, infinity or a value too large for dtype('float64')&rdquo; I have spent more than two days on the above error but I am unable to fix above error. Can somebody help me in fixing above error?
asked Feb 24, 2020 mphil 2.3k points
0 votes
1 answer 250 views
250 views
Problem: I am trying deletesome column and convert some value to column with df2.drop(df2.columns[[0, 1, 3]], axis=1, inplace=True) df2['date'] = df2['date'].map(lambda x: str(x)[1:]) df2['date'] = df2['date'].str.replace(':', ' ', 1) ... : A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead What's the problem?
asked Nov 14, 2020 sasha 5.3k points
1 vote
1 answer 317 views
317 views
Problem : I am very new to Python. While trying to execute my code I am facing below warning C:\Python27\lib\site-packages\pandas\core\indexing.py:411: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer ... '] = mydf.review_text.map(lambda x: tokenizer.tokenize(x)) print mydf[:3] I am looking for expert help to fix above error.
asked Apr 27, 2020 stewart 4k points
0 votes
1 answer 570 views
570 views
Problem: I am beginner to Python programming. I am trying to do some very simple PySide and PyQt tutorials in the IPython. In one of the tasks I simply needs to create the window with some of the sliders to exhibit the slots and signals.But as soon as I close a window of my ... /scratch/<ipython-input-1-88966dcfb499> in main() 29 w.show() 30 app.exec_() ---> 31 sys.exit(0) 32 33 SystemExit: 0
asked Aug 8, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 13 views
13 views
Problem: I got the data column: print(df["Hour"]) Hour 0 01:21:46 1 01:22:16 2 01:22:46 3 01:25:16 4 01:25:46 It says the column type is an object, but when I try to convert from pd.to_datetime, it says TypeError: <class 'datetime.time'> is ... to minutes, so I tried with df["Hour"].dt.seconds, but it shows an error:AttributeError: Can only use .dt accessor with datetimelike values. Hel, please!
asked Jan 1 sasha 5.3k points
0 votes
0 answers 93 views
93 views
import cv2, time, pandas import numpy as np from termcolor import colored import datetime import pandas as pd import matplotlib.pyplot as plt import os import pyautogui from bokeh.plotting import figure, show, output_file from bokeh.models import HoverTool, ColumnDataSource first_frame = None ... ).strftime("%Y-%m-%d_%H%M%S")+".html") show(p) #plt.savefig('plot.pdf', dpi=300, bbox_inches='tight')
asked Jun 13, 2020 Shivi Trivedi
2 votes
1 answer 2.3K views
2.3K views
Problem : I am very new to Python and Pandas. Currently I am learning to use the Pandas so that I can convert my column to month. When I try to read my data then they are objects. So I am first of all trying to make them to the date time and ... " 2529 "values") 2530 AttributeError: Can only use .dt accessor with datetimelike values Looking for help from Pandas expert to fix my above error.
asked Apr 29, 2020 stewart 4k points
0 votes
1 answer 1.7K views
1.7K views
Problem : I am getting bellow error attributeerror: can only use .str accessor with string values, which use np.object_ dtype in pandas
asked Nov 7, 2019 peterlaw 6.9k points