Questions tagged [eager-execution]

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
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
0

answer
81

Views

Manually access and update trainable variables from keras model when eager execution is enabled

How does one access and update trainable variables when using eager execution and a keras sequential model? I see some code in the tf optimizer that seems to handle both graph mode and eager execution, but it's really hard for me to follow. I'd like to know more directly how to update the trainabl...
user3496060
1

votes
1

answer
43

Views

Difficulty with running gradient descent in eager execution

I've built a neural network with python in TensorFlow, but I can't seem to resolve this issue with TensorFlow's eager execution. All the gradients output zero, and I'm not really sure where I've gone wrong in the program. Originally I was using ReLU, and I thought that was the issue in the network,...
Espresso
1

votes
0

answer
22

Views

dynamic_decode reports error under eager_execution ? “ValueError: The inequality of unknown TensorShapes is undefined."

I have encountered a weird problem when transforming a usual seq2seq code into eager execution mode. What I changed is very simple that after call enable_eager_execution(), I changed the following input def get_inputs(): inputs = tf.placeholder(tf.int32, [None, None], name='inputs') targets = tf.pl...
Jack2019
1

votes
1

answer
27

Views

Tensorflow.py Protected division

I'm trying to implement a sort of protected division using Tensorflow.where but somehow it seems to be skipping the condition set on the where statement. The main idea is, when dividing x/y , if y == 0. then the result of the division of be x instead of throwing and error. My code is as follows: d...
eXistanCe
1

votes
0

answer
33

Views

Distributed execution under eager mode using tensorflow

According to a recently published white paper and the RFC on GitHub, tensorflow eager currently supports distributed execution. It is mentioned that, similar to the graph mode, we can run an operation eagerly on a remote device by setting the device name as, for example, '/job:training/task:2/device...
Kevin Lee
1

votes
0

answer
23

Views

How to obtain second derivatives of a Loss function with respect to the parameters of a neural network using gradient tape in Tensorflow eager mode

I am creating a basic auto-encoder for the MNIST dataset using TensorFlow eager mode. I would like to observe the second-order partial derivatives of my loss function with respect to the parameters of the network as it trains. Currently, calling tape.gradient() on the output of in_tape.gradient retu...
Devon Jarvis
1

votes
0

answer
26

Views

Using tf.keras.Model as base class for defining RNN Cell

I'm working within TensorFlow's EagerExecution to develop a variation of Variational Autoencoder (VAE) in a sequential data setting. Since both recurrent network structure and its input-output flow are not standard, I have to build my own custom RNNCell, which later can be passed to tf.nn.raw_rnn AP...
lalala.yeyeye
1

votes
1

answer
19

Views

Understanding device allocation, parallelism(tf.while_loop) and tf.function in tensorflow

I'm trying to understand parallelism on GPU in tensorflow as I need to apply it on uglier graphs. import tensorflow as tf from datetime import datetime with tf.device('/device:GPU:0'): var = tf.Variable(tf.ones([100000], dtype=tf.dtypes.float32), dtype=tf.dtypes.float32) @tf.function def foo(): retu...
caissalover
1

votes
0

answer
65

Views

tensorflow eager execution outputs only same values

I'm trying to convert my tensorflow code to tensorflow eager. The problem is the forward pass predicts only the same actions for different input values in eager mode. The normal tensorflow code with graph works fine. I've only changed the network. The agent is the same I'm used with normal tensorflo...
tk338
1

votes
0

answer
30

Views

Reconstruction loss on regression type of Variational Autoencoder

I'm currently working on a variation of Variational Autoencoder in a sequential setting, where the task is to fit/recover a sequence of real-valued observation data (hence it is a regression problem). I have built my model using tf.keras with eager execution enabled, and tensorflow_probability (tfp...
lalala.yeyeye
2

votes
1

answer
19

Views

tensorflow gradients in eager mode return zeros

The problem: I'm loading a simple VGG16 from a saved checkpoint. I want to generate the saliency for an image during inference. When i compute the gradients (of loss wrt input image) required for this, i get back all gradients as zero. Any ideas as to what I'm missing here is much appreciated! tf ve...
borarak
1

votes
1

answer
0

Views

how to update an 'eagertensor" object in tensorflow

How to update the variables from a keras sequential model (model.variables) if they are eagertensors? When I try to assign to them I get an error that says the object has no attribute 'assign'.
user3496060
1

votes
1

answer
0

Views

Param for tf.contrib.summary.graph

I am using tensorflow 1.12 and the eager execution mode. I want to summarize the graph to the tensorboard log. I found a function called tf.contrib.summary.graph, however, it requires a parameter called param. What should I pass for this parameter? Thanks.
Tao
1

votes
1

answer
0

Views

How to combine multiple datasets into one dataset?

Suppose I have 3 tfrecord files, namely neg.tfrecord, pos1.tfrecord, pos2.tfrecord. I use dataset = tf.data.TFRecordDataset(tfrecord_file) this code creates 3 Dataset objects. My batch size is 400, including 200 neg data, 100 pos1 data, and 100 pos2 data. How can I get the desired dataset? I will us...
Gary
1

votes
1

answer
33

Views

TensorFlow 2.0: Eager execution of training either returns bad results or doesn't learn at all

I am experimenting with TensorFlow 2.0 (alpha). I want to implement a simple feed forward Network with two output nodes for binary classification (it's a 2.0 version of this model). This is a simplified version of the script. After I defined a simple Sequential() model, I set: # set basic hyperparam...
Leevo