Questions tagged [eager-execution]

TensorFlow's eager execution is an imperative programming environment that evaluates operations immediately, without building graphs: operations return concrete values instead of constructing a computational graph to run later. This makes it easy to get started with TensorFlow and debug models, and it reduces boilerplate as well. To follow along with this guide, run the code samples below in an interactive python interpreter.

146 questions
2
votes
0 answers

Tensorflow fails to stay in eager execution, TF2.x

I'm using TF2.x with eager execution on by default. However, when using a custom loss function, it reports that eager execution is False. tf import veryfing eager execution is True: import tensorflow as tf print(tf.executing_eagerly()) Which…
Al0000
  • 73
  • 6
2
votes
1 answer

How to reuse the inner gradient in nested gradient tapes?

I am working on a routine in tensorflow 1.15 that evaluates several hessian-vector products for different vectors def hessian_v_prod(self, v): with tf.GradientTape() as t1: with tf.GradientTape() as t2: # evaluate loss which…
2
votes
1 answer

Forcing eager execution in tensorflow 2.1.0

I am new to tensorflow and Deep Learning as a whole. I have created a custom loss function but it seems that within the custom loss function, eager execution is not enabled. Below is my custom loss function (it doesn't work): def…
Spartacus98
  • 82
  • 1
  • 9
2
votes
1 answer

Turning off tensorflow autograph

I'm using tf.data.Dataset.map(process_fn) instruction, the mapping function is composed purely tensorflow graph functions, still it seems that Autograph is trying to transform them. How can I prevent it? How can I force tensorflow to use my pice of…
Xyz
  • 1,522
  • 17
  • 23
2
votes
1 answer

How to save and restore a mode's weights with tf.keras.Model - TensorFlow 2.0 - Subclassing API

In the examples here it mentions that one can subclass the class tf.keras.Model as follows: class MyModel(tf.keras.Model): def __init__(self): super(MyModel, self).__init__() self.dense1 = tf.keras.layers.Dense(4,…
MattSt
  • 1,024
  • 2
  • 16
  • 35
2
votes
1 answer

Do variable_scope and name_scope have any purpose in TensorFlow 2 with eager execution?

In TensorFlow 2, eager execution is the default execution. There is no need for annoying sessions or placeholders. There are so many questions related to name_scope, variable_scope, etc., on Stack Overflow, for example, What is the difference…
nbro
  • 15,395
  • 32
  • 113
  • 196
2
votes
0 answers

Tensorflow with Eager Execution: DDPG - Apply Action Gradient to Actor

I am struggling to apply the Tensorflow eager execution (TF2) in order to train the actor of the actor-critic DDPG algorithm. The description in this example explains: Use the actor’s online network to get the action mean values using the current…
2
votes
1 answer

tensorflow 2.0: tf.GradientTape().gradient() returns None

I designed my own loss function for my graduate research, it calculates the distance between the histogram of losses and normal distribution. I am implementing this loss function in the setting of Tensorflow 2.0 tutorial about Iris flower…
2
votes
1 answer

How can I use the Keras.applications' ResNeXt in TensorFlow's eager execution?

I am trying to get ResNet101 or ResNeXt, which are only available in Keras' repository for some reason, from Keras applications in TensorFlow 1.10: import tensorflow as tf from keras import applications tf.enable_eager_execution() resnext =…
user4028648
2
votes
0 answers

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

We always use tf.train.Saver() to save and restore weights, like in this example. 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 found tf.contrib.eager.Saver here,…
andy
  • 1,951
  • 5
  • 16
  • 30
2
votes
0 answers

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…
2
votes
1 answer

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…
2
votes
2 answers

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],…
sagar_acharya
  • 346
  • 4
  • 18
2
votes
1 answer

How to use tf.while_loop with eager execution?

In the documentation, the body of a tf.while_loop needs to be a python callable. i = tf.constant(0) b = lambda i: tf.add(i,1) c = lambda i: tf.less(i,10) tf.while_loop(c,b, [i]) works but def b(i): tf.add(i,1) i = tf.constant(0) c = lambda i:…
sagar_acharya
  • 346
  • 4
  • 18
2
votes
0 answers

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…
1 2
3
9 10