Questions tagged [tensorflow]

16944 questions
3

votes
0

answer
20

Views

Computational graph vs (computer algebra) symbolic expression

I was reading Baydin et al, Automatic Differentiation in Machine Learning: a Survey, 2018 (Arxiv), which differentiates between symbolic differentiation and automatic differentiation (AD). It then says: AD Is Not Symbolic Differentiation. Symbolic differentiation is the automatic manipulation of [sy...
Albert
0

votes
0

answer
3

Views

TypeError: Eager execution of tf.constant with unsupported shape

I'm trying to modify the code from 'Probabilistic_Layers_Regression.ipynb' for input_shape of 8 and output_shape of 8. I get the following error from the sample code below. Any ideas why? Thanks ----Error------ TypeError Traceback (most recent call last) in () 11 dtype=x.dtype)[..., np.newaxis]), 12...
user1695683
0

votes
0

answer
3

Views

how to use eager execution to save and restore in TensorFlow?

We always use tf.train.Saver() to save and restore weights, like the following example(https://www.tensorflow.org/guide/saved_model). But how to use eager execution to save? how to change the following example? Another question, is it a good idea to use eager? I fond tf.contrib.eager.Saver in (ht...
andy
1

votes
1

answer
525

Views

Trading in precision for better recall in Keras classification neural net

There's always a tradeoff between precision and recall. I'm dealing with a multi-class problem, where for some classes I have perfect precision but really low recall. Since for my problem false positives are less of an issue than missing true positives, I want reduce precision in favor of increasin...
megashigger
1

votes
1

answer
2.3k

Views

Install gcc and g++ version < 6 in fedora 27 [closed]

I am installing cuda and tensorflow-gpu on fedora 27. But for building binaries of tensorflow it requires gcc and g++ of version less than 6. Fedora comes with already installed gcc and g++ of version 7.3.1 . Can anyone help me with installing gcc and g++ of older versions ? I've already tried : su...
DEVENDRA MEENA
1

votes
1

answer
346

Views

Tensorflow reset Adam Optimizer internal state every n minibatches

That is my question: How to reset the Tensorflow Adam Optimizer internal state every n mini batches? By internal state I mean the m(t), past gradients, and v(t), past squared gradients, parameters.
Seguy
1

votes
1

answer
3.9k

Views

KeyError : The tensor variable , Refer to the tensor which does not exists

Using LSTMCell i trained a model to do text generation . I started the tensorflow session and save all the tensorflow varibles using tf.global_variables_initializer() . import tensorflow as tf sess = tf.Session() //code blocks run_init_op = tf.global_variables_intializer() sess.run(run_init_op) sa...
Madhi
1

votes
3

answer
906

Views

How to use TensorBoard and summary operations with the tf.layers module

I have followed the TensorFlow Layers tutorial to create a CNN for MNIST digit classification using TensorFlow's tf.layers module. Now I'm trying to learn how to use TensorBoard from TensorBoard: Visualizing Learning. Perhaps this tutorial hasn't been updated recently, because it says its example co...
erobertc
1

votes
5

answer
1.2k

Views

Python add one more channel to image

I'm trying to add channel because of below error ValueError: could not broadcast input array from shape (48,48) into shape (48,48,1) Code: img = cv2.imread(f,0) resized = cv2.resize(img, (48,48), interpolation = cv2.INTER_AREA) print(resized.shape) (48, 48) But I need a channel image like (48,48,1...
Hasan Ramazan
1

votes
1

answer
1k

Views

What does it mean for a tensor to have shape [None, x] in TensorFlow? [duplicate]

This question already has an answer here: Tensorflow batch size in input placholder 1 answer If I define a tf placeholder as: tf.placeholder('float', [None, 10]) what does the None do? What is the linear algebra interpretation of this? A horizontal vector?
Sahand
1

votes
2

answer
693

Views

How to build the c library for tensorflow

I've been through the steps to build tensorflow and it's working in python. Now how do I BUILD the C tensorflow library I want to use? $ gcc -I../tensorflow -ltensorflow g.c /usr/bin/ld: cannot find -ltensorflow collect2: error: ld returned 1 exit status
effbiae
1

votes
1

answer
762

Views

Implement simple PPO Agent in TensorFlow

I read this good article about the Proximal Policy Optimization algorithm, and now I want update my VanillaPG agent to a PPO agent to learn more about it. However, I'm still not sure how to implement this in real code, especially since I'm using a simple discrete action space. So what I do with my V...
alexander
1

votes
1

answer
548

Views

TypeError: Input 'b' of 'MatMul' Op has type float32 that does not match type int32 of argument 'a' - even after casting

I get the following error when I try to run the following program TypeError: Input 'b' of 'MatMul' Op has type float32 that does not match type int32 of argument 'a'. I figured it says that _x is of type int32, but I already cast it using tf.cast import tensorflow as tf import numpy as np x = ([[3,...
ab123
1

votes
1

answer
97

Views

How do I train a model using two loss functions?

I have a TensorFlow graph with two loss functions. I want to train my model alternatively: Train the model using the first loss function. Train the model using the second loss function. Repeat one and two until convergence. Do I have to create two graphs then load, train and save the weights for eve...
nairouz mrabah
-1

votes
0

answer
11

Views

What are the technologies I have to hire to make a AI based Camera APP for a Desktop?

(Note : if the question belong to different stackexhange notify me or mark for migration.Don't downvote ) Our decided to develop an application with below features The aim of the application is to dress a person using previously uploaded clothing materials who is standing before a display with camer...
Lord Commander
1

votes
1

answer
890

Views

Is it possible to quantize a tflite model?

I have a .pb model, which I want to use as a custom MLKit model. MLKit only supports .tflite models, but even after I use toco to get the TensorFlow Lite model, the file size is too large for Firebase (95 MB and only 40 MB allowed). Is there a way to quantize the graph and then convert to TFLite or...
nerdcortex
1

votes
2

answer
131

Views

Tensorflow errors GPU installation

After installing tensorflow GPU, I'm getting the error code below. I've spent hours reviewing existing questions and have not been successful in solving the problem. Thanks. >>> import tensorflow as tf Traceback (most recent call last): File '/home/toddahoffman/tensorflow/lib/python3.6/site-packages...
Todd Hoffman
1

votes
2

answer
297

Views

Calculating tensorflow gradients

I am confused by the example in the tensorflow gradient documentation for computing the gradient. a = tf.constant(0.) b = 2 * a g = tf.gradients(a + b, [a, b]) with tf.Session() as sess: print(sess.run(g)) which gives [3.0, 1.0] I feel like I am really missing something obvious but if a is essential...
piccolo
1

votes
2

answer
3.7k

Views

module 'tensorflow.python.keras.datasets.fashion_mnist' has no attribute 'load_data'

I am currently following this intro tutorial on the Keras website: https://www.tensorflow.org/tutorials/keras/basic_classification Several steps in I run into this error after calling fashion_mnist.load_data(): AttributeError: module 'tensorflow.python.keras.datasets.fashion_mnist' has no attribute...
Brendan Gregory
1

votes
1

answer
761

Views

Can I add Tensorflow Fake Quantization in a Keras sequential model?

I have searched this for a while, but it seems Keras only has quantization feature after the model is trained. I wish to add Tensorflow fake quantization to my Keras sequential model. According to Tensorflow's doc, I need these two functions to do fake quantization: tf.contrib.quantize.create_traini...
17_Python
1

votes
2

answer
119

Views

Always same output for tensorflow autoencoder

At the moment I try to build an Autoencoder for timeseries data in tensorflow. I have nearly 500 days of data where each day have 24 datapoints. Since this is my first try my architecture is very simple. After my input of size 24 the hidden layers are of size: 10; 3; 10 with an output of again 24. I...
Marvin K
1

votes
1

answer
293

Views

KERAS “sparse_categorical_crossentropy” question

As an input a have a float 1.0 or 0.0. When I try to predict with my model and the sparse_categorical_crossentropy loss I get something like: [[0.4846592 0.5153408]]. How do I know what category it predicts?
user9468014
1

votes
1

answer
305

Views

Keras Embedding ,where is the “weights” argument?

I have seen such kind of code as follow: embed_word = Embedding(params['word_voc_size'], params['embed_dim'], weights=[word_embed_matrix], input_length = params['word_max_size'] , trainable=False, mask_zero=True) When I look up the document in Keras website [https://faroit.github.io/keras-docs/2.1.5...
Johnny
1

votes
1

answer
412

Views

pip search finds tensorflow, but pip install does not

I am trying to build a Django app that would use Keras models to make recommendations. Right now I'm trying to use one custom container that would hold both Django and Keras. Here's the Dockerfile I've written. # myproject/docker/app/Dockerfile FROM python:3.7-alpine # I've tried 3.5, 3.6 and 3.7 R...
julka
1

votes
2

answer
150

Views

Anaconda3 issues installing Tensorflow

I am trying to install Tensorflow on Windows 10 using Anaconda3. I get the following error message after every attempt. 'Command 'python setup.py egg_info' failed with error code 3221226505 in C:\Users\user\AppData\Local\Temp\pip-install- 8j_eg21o\termcolor\' I Create a new Anaconda Container and...
Quentin
1

votes
2

answer
849

Views

Why I cannot import Tensorflow.contrib I get an error of No module named 'tensorflow.python.saved

Hi I just installed Tensorflow on my Mac and I want to use tf.contrib.slim but when I use it I get this import tensorflow as tf slim = tf.contrib.slim Error: File '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/export/export_lib.p...
Daromogo
1

votes
1

answer
61

Views

In TensorFlow 2.0: Training error with optimizer.apply_gradients

I am trying to learn the new TF 2.0 alpha release. I'm training a Sequential model for a binary classification purpose. My datatable is df, which is a numpy array. classification is the one-hot encoding dataframe of the classes I must predict. The definition of the model is clear, as it is the defin...
Leevo
1

votes
3

answer
62

Views

Difference btwn high and low level libraries

What is the difference btwn high level and low level libraries? I understand that keras is a high level library and tensorflow is a low level library but I'm still not familiar enough with these frameworks to understand what that means for high vs low libraries.
maddie
1

votes
1

answer
59

Views

How to add/change names of components to an existing Tensorflow Dataset object?

From the Tensorflow dataset guide it says It is often convenient to give names to each component of an element, for example if they represent different features of a training example. In addition to tuples, you can use collections.namedtuple or a dictionary mapping strings to tensors to represent a...
SantoshGupta7
1

votes
1

answer
35

Views

Eager execution of tf.dataset instances

I build a tf.data.Dataset.from_tensor_slices() with version 2.0. My input is a one-dimensional array, which contains indexes for clipping a large numpy array (60 GB). My Pipeline so far reads the array with np.memmap and should then clips this array. Therefore, I create an array in the dimensions (...
Lau
1

votes
1

answer
62

Views

AttributeError: module 'tensorflow' has no attribute 'gfile'

I trained a simple mnist model with tensorflow 2.0 on Google Colab and saved it in the .json format. Click here to check out the Colab Notebook where I've written the code. Then on running the command !simple_tensorflow_serving --model_base_path='/' --model_platform='tensorflow' It is showing the er...
1

votes
1

answer
59

Views

Tensorflow: Sigmoid cross entropy loss does not force network outputs to be 0 or 1

I would like to learn image segmentation in TensorFlow with values in {0.0,1.0}. I have two images, ground_truth and prediction and each have shape (120,160). The ground_truth image pixels only contain values that are either 0.0 or 1.0. The prediction image is the output of a decoder and the last tw...
Fábio
1

votes
1

answer
35

Views

Hot load of models into tensorflow serving container

I know how to load a model into a container and also I know that we can create a static config file and when we run a tensorflow serving container pass it to the container and later use one the models inside that config files but I want to know if there is any way to hot load a completely new model...
AVarf
1

votes
1

answer
17

Views

Missing val_acc after fitting sequential model

I am missing information about the 'val_acc' attribute when I fit a compiled sequential model. I have a sequential model that is compiled with 'accuracy' metrics model = Sequential() model.add(Dense(12, input_dim=8, activation='relu')) model.add(Dense(8, activation='relu')) model.add(Dense(1, activ...
pobu
1

votes
1

answer
45

Views

Why are the prediction probabilities so high for images with no defined class?

I have been stuck here for too long now. I am trying to create a CNN that could detect the numbers in an image. For this I started working with The Street View House Numbers (SVHN) Dataset. This dataset comes with pre-processed images scaled to 32x32 digits.There are 10 classes for 10 numbers. I t...
Amanda
1

votes
1

answer
79

Views

How to use gradient_override_map in Tensorflow 2.0?

I'm trying to use gradient_override_map with Tensorflow 2.0. There is an example in the documentation, which I will use as the example here as well. In 2.0, GradientTape can be used to compute gradients as follows: import tensorflow as tf print(tf.version.VERSION) # 2.0.0-alpha0 x = tf.Variable(5.0...
IonicSolutions
0

votes
0

answer
8

Views

Which Tensorflow Models Use The Least Computational Power

I am looking for recommendations on the best models FRCNN, YOLO, etc. for low power computation real time video analysis. Do individual models have better performance, what decides this and is there established literature on this? Thank you.
jn1351
1

votes
1

answer
22

Views

How do I fix the dimension of the return value of flow from Image Generator?

I am trying to use fit_generator. But I get the error Error when checking input: expected sequential_1_input to have 3 dimensions, but got array with shape (20, 28, 28, 1) Here is the code: data_flow = data_generator.flow(x_train, y_train,batch_size=20) generate = model.fit_generator(data_flow, st...
Kiran Shrestha
0

votes
0

answer
11

Views

What does Keras model.predict returns?

I am building an autoencoder network for finding outliers in a single-column list of text. I pick up each character, transform it to ASCII, and put them into an array. Each line of the array is a row of my input, and each element in the array is an integer representation of the ascii code for the ch...
gtbono
0

votes
0

answer
22

Views

Design neural network to find inputs with highest probability of class

I am designing a neural network for classification with the aim to find the inputs with the highest probability that they belong to one of two classes. There are two classes, class A and class B. I have a set of data of which I want to find the inputs that have the highest probability that they belo...
ig-dev

View additional questions