Questions tagged [tensorflow]
TensorFlow is an open-source library and API designed for deep learning, written and maintained by Google. Use this tag with a language-specific tag ([python], [c++], [javascript], [r], etc.) for questions about using the API to solve machine learning problems. The programming languages that can be used with TensorFlow API vary, so you must specify the programming language. Please specify the application area such as [object-detection] as well.
tensorflow
82,801
questions
777
votes
11
answers
680k
views
Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
I have recently installed tensorflow (Windows CPU version) and received the following message:
Successfully installed tensorflow-1.4.0 tensorflow-tensorboard-0.4.0rc2
Then when I tried to run
import ...
714
votes
61
answers
966k
views
TensorFlow not found using pip
I'm trying to install TensorFlow using pip:
$ pip install tensorflow --user
Collecting tensorflow
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching ...
662
votes
28
answers
491k
views
How to save/restore a model after training?
After you train a model in Tensorflow:
How do you save the trained model?
How do you later restore this saved model?
481
votes
8
answers
251k
views
What are logits? What is the difference between softmax and softmax_cross_entropy_with_logits?
In the tensorflow API docs they use a keyword called logits. What is it? A lot of methods are written like:
tf.nn.softmax(logits, name=None)
If logits is just a generic Tensor input, why is it named ...
448
votes
32
answers
852k
views
How to tell if tensorflow is using gpu acceleration from inside python shell?
I have installed tensorflow in my ubuntu 16.04 using the second answer here with ubuntu's builtin apt cuda installation.
Now my question is how can I test if tensorflow is really using gpu? I have a ...
443
votes
10
answers
272k
views
What is the meaning of the word logits in TensorFlow? [duplicate]
In the following TensorFlow function, we must feed the activation of artificial neurons in the final layer. That I understand. But I don't understand why it is called logits? Isn't that a mathematical ...
441
votes
16
answers
422k
views
What is the difference between 'SAME' and 'VALID' padding in tf.nn.max_pool of tensorflow?
What is the difference between 'SAME' and 'VALID' padding in tf.nn.max_pool of tensorflow?
In my opinion, 'VALID' means there will be no zero padding outside the edges when we do max pool.
...
392
votes
20
answers
1.2m
views
How to find which version of TensorFlow is installed in my system?
I need to find which version of TensorFlow I have installed. I'm using Ubuntu 16.04 Long Term Support.
390
votes
26
answers
972k
views
Could not find a version that satisfies the requirement tensorflow
I installed the latest version of Python (3.6.4 64-bit) and the latest version of PyCharm (2017.3.3 64-bit). Then I installed some modules in PyCharm (Numpy, Pandas, etc), but when I tried installing ...
372
votes
16
answers
280k
views
How to prevent tensorflow from allocating the totality of a GPU memory?
I work in an environment in which computational resources are shared, i.e., we have a few server machines equipped with a few Nvidia Titan X GPUs each.
For small to moderate size models, the 12 GB of ...
352
votes
21
answers
330k
views
Disable Tensorflow debugging information
By debugging information I mean what TensorFlow shows in my terminal about loaded libraries and found devices etc. not Python errors.
I tensorflow/stream_executor/dso_loader.cc:105] successfully ...
329
votes
13
answers
943k
views
Convert a tensor to numpy array in Tensorflow?
How to convert a tensor into a numpy array when using Tensorflow with Python bindings?
329
votes
7
answers
578k
views
Which TensorFlow and CUDA version combinations are compatible?
I have noticed that some newer TensorFlow versions are incompatible with older CUDA and cuDNN versions. Does an overview of the compatible versions or even a list of officially tested combinations ...
322
votes
12
answers
292k
views
How to compile Tensorflow with SSE4.2 and AVX instructions?
This is the message received from running a script to check if Tensorflow is working:
I tensorflow/stream_executor/dso_loader.cc:125] successfully opened CUDA library libcublas.so.8.0 locally
I ...
318
votes
15
answers
116k
views
What's the difference between tf.placeholder and tf.Variable?
I'm a newbie to TensorFlow. I'm confused about the difference between tf.placeholder and tf.Variable. In my view, tf.placeholder is used for input data, and tf.Variable is used to store the state of ...
313
votes
24
answers
634k
views
How to print the value of a Tensor object in TensorFlow?
I have been using the introductory example of matrix multiplication in TensorFlow.
matrix1 = tf.constant([[3., 3.]])
matrix2 = tf.constant([[2.],[2.]])
product = tf.matmul(matrix1, matrix2)
When I ...
298
votes
8
answers
110k
views
What's the difference of name scope and a variable scope in tensorflow?
What's the differences between these functions?
tf.variable_op_scope(values, name, default_name, initializer=None)
Returns a context manager for defining an op that creates variables.
This ...
288
votes
52
answers
863k
views
Could not install packages due to an EnvironmentError: [WinError 5] Access is denied:
I have windows 10. I have completed installing Tensorflow. It works. It says "Hello Tensorflow!". But it has all of this before it:
2018-08-18 18:16:01.500579: I T:\src\github\tensorflow\...
247
votes
8
answers
177k
views
Ordering of batch normalization and dropout?
The original question was in regard to TensorFlow implementations specifically. However, the answers are for implementations in general. This general answer is also the correct answer for TensorFlow.
...
238
votes
16
answers
430k
views
How to get current available GPUs in tensorflow?
I have a plan to use distributed TensorFlow, and I saw TensorFlow can use GPUs for training and testing. In a cluster environment, each machine could have 0 or 1 or more GPUs, and I want to run my ...
236
votes
17
answers
489k
views
Tensorflow 2.0 - AttributeError: module 'tensorflow' has no attribute 'Session'
When I am executing the command sess = tf.Session() in Tensorflow 2.0 environment, I am getting an error message as below:
Traceback (most recent call last):
File "<stdin>", line 1, in ...
231
votes
13
answers
316k
views
Keras, How to get the output of each layer?
I have trained a binary classification model with CNN, and here is my code
model = Sequential()
model.add(Convolution2D(nb_filters, kernel_size[0], kernel_size[1],
border_mode=...
223
votes
6
answers
128k
views
In TensorFlow, what is the difference between Session.run() and Tensor.eval()?
TensorFlow has two ways to evaluate part of graph: Session.run on a list of variables and Tensor.eval. Is there a difference between these two?
218
votes
13
answers
172k
views
How to build and use Google TensorFlow C++ api
I'm really eager to start using Google's new Tensorflow library in C++. The website and docs are just really unclear in terms of how to build the project's C++ API and I don't know where to start.
...
210
votes
13
answers
228k
views
How can I run Tensorboard on a remote server?
I'm new to Tensorflow and would greatly benefit from some visualizations of what I'm doing. I understand that Tensorboard is a useful visualization tool, but how do I run it on my remote Ubuntu ...
207
votes
17
answers
312k
views
TypeError: Descriptors cannot not be created directly
I tried to install Ray, but it gave an error:
TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated ...
203
votes
9
answers
166k
views
What is the difference between steps and epochs in TensorFlow?
In most of the models, there is a steps parameter indicating the number of steps to run over data. But yet I see in most practical usage, we also execute the fit function N epochs.
What is the ...
200
votes
13
answers
280k
views
How to run Tensorflow on CPU
I have installed the GPU version of tensorflow on an Ubuntu 14.04.
I am on a GPU server where tensorflow can access the available GPUs.
I want to run tensorflow on the CPUs.
Normally I can use env ...
198
votes
2
answers
41k
views
Why is TensorFlow 2 much slower than TensorFlow 1?
It's been cited by many users as the reason for switching to Pytorch, but I've yet to find a justification/explanation for sacrificing the most important practical quality, speed, for eager execution.
...
189
votes
10
answers
194k
views
What is the role of "Flatten" in Keras?
I am trying to understand the role of the Flatten function in Keras. Below is my code, which is a simple two-layer network. It takes in 2-dimensional data of shape (3, 2), and outputs 1-dimensional ...
175
votes
4
answers
85k
views
TensorFlow, why was python the chosen language?
I recently started studying deep learning and other ML techniques, and I started searching for frameworks that simplify the process of build a net and training it, then I found TensorFlow, having ...
174
votes
9
answers
78k
views
What does tf.nn.embedding_lookup function do?
tf.nn.embedding_lookup(params, ids, partition_strategy='mod', name=None)
I cannot understand the duty of this function. Is it like a lookup table? Which means to return the parameters corresponding ...
171
votes
2
answers
63k
views
Understanding TensorBoard (weight) histograms
It is really straightforward to see and understand the scalar values in TensorBoard. However, it's not clear how to understand histogram graphs.
For example, they are the histograms of my network ...
170
votes
7
answers
359k
views
Can I run Keras model on gpu?
I'm running a Keras model, with a submission deadline of 36 hours, if I train my model on the cpu it will take approx 50 hours, is there a way to run Keras on gpu?
I'm using Tensorflow backend and ...
166
votes
6
answers
70k
views
How does tf.app.run() work?
How does tf.app.run() work in Tensorflow translate demo?
In tensorflow/models/rnn/translate/translate.py, there is a call to tf.app.run(). How is it being handled?
if __name__ == "__main__":
tf....
162
votes
19
answers
454k
views
Tensorflow - ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type float)
Continuation from previous question: Tensorflow - TypeError: 'int' object is not iterable
My training data is a list of lists each comprised of 1000 floats. For example, x_train[0] =
[0.0, 0.0,...
160
votes
19
answers
475k
views
Could not load dynamic library 'cudart64_101.dll' on tensorflow CPU-only installation
I just installed the latest version of Tensorflow via pip install tensorflow and whenever I run a program, I get the log message:
W tensorflow/stream_executor/platform/default/dso_loader.cc:55] ...
153
votes
12
answers
250k
views
Deep-Learning Nan loss reasons
What would cause a Convolutional Neural Network to diverge?
Specifics:
I am using Tensorflow's iris_training model with some of my own data and keep getting
ERROR:tensorflow:Model diverged with loss =...
153
votes
7
answers
92k
views
What does tf.nn.conv2d do in tensorflow?
I was looking at the docs of tensorflow about tf.nn.conv2d here. But I can't understand what it does or what it is trying to achieve. It says on the docs,
#1 : Flattens the filter to a 2-D matrix ...
150
votes
1
answer
5k
views
How are the new tf.contrib.summary summaries in TensorFlow evaluated?
I'm having a bit of trouble understanding the new tf.contrib.summary API. In the old one, it seemed that all one was supposed to do was to run tf.summary.merge_all() and run that as an op.
But now we ...
148
votes
8
answers
135k
views
Loading a trained Keras model and continue training
I was wondering if it was possible to save a partly trained Keras model and continue the training after loading the model again.
The reason for this is that I will have more training data in the ...
146
votes
9
answers
255k
views
What does this tensorflow message mean? Any side effect? Was the installation successful?
I just installed tensorflow v2.3 on anaconda python. I tried to test out the installation using the python command below;
$ python -c "import tensorflow as tf; x = [[2.]]; print('tensorflow ...
142
votes
10
answers
165k
views
In Tensorflow, get the names of all the Tensors in a graph
I am creating neural nets with Tensorflow and skflow; for some reason I want to get the values of some inner tensors for a given input, so I am using myClassifier.get_layer_value(input, "tensorName"), ...
136
votes
4
answers
99k
views
TensorFlow, why there are 3 files after saving the model?
Having read the docs, I saved a model in TensorFlow, here is my demo code:
# Create some variables.
v1 = tf.Variable(..., name="v1")
v2 = tf.Variable(..., name="v2")
...
# Add an op to initialize the ...
135
votes
8
answers
119k
views
Should we do learning rate decay for adam optimizer
I'm training a network for image localization with Adam optimizer, and someone suggest me to use exponential decay. I don't want to try that because Adam optimizer itself decays learning rate. But ...
135
votes
4
answers
45k
views
Difference between Variable and get_variable in TensorFlow
As far as I know, Variable is the default operation for making a variable, and get_variable is mainly used for weight sharing.
On the one hand, there are some people suggesting using get_variable ...
132
votes
6
answers
83k
views
Meaning of buffer_size in Dataset.map , Dataset.prefetch and Dataset.shuffle
As per TensorFlow documentation , the prefetch and map methods of tf.contrib.data.Dataset class, both have a parameter called buffer_size.
For prefetch method, the parameter is known as buffer_size ...
129
votes
23
answers
327k
views
TensorFlow, "'module' object has no attribute 'placeholder'"
I've been trying to use tensorflow for two days now installing and reinstalling it over and over again in python2.7 and 3.4. No matter what I do, I get this error message when trying to use ...
129
votes
13
answers
150k
views
Keras split train test set when using ImageDataGenerator
I have a single directory which contains sub-folders (according to labels) of images. I want to split this data into train and test set while using ImageDataGenerator in Keras. Although model.fit() in ...
126
votes
4
answers
49k
views
Tensorflow Strides Argument
I am trying to understand the strides argument in tf.nn.avg_pool, tf.nn.max_pool, tf.nn.conv2d.
The documentation repeatedly says
strides: A list of ints that has length >= 4. The stride of the ...