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.
Questions tagged [eager-execution]
146 questions
1
vote
0 answers
Tensorflow - performance issue between eager and graph modes
I'm facing an issue and I need your help.
I'm trying to benchmark execution time between eager and graph modes.
I'm using a very simple model (only one dense layer).
Here is the graph version:
import tensorflow as tf
import numpy as np
import…

Pelups
- 78
- 1
- 1
- 5
1
vote
1 answer
Tensorflow 2.0.0-beta1: 'EagerTensor object is not callable'
I am trying to implement custom training with Tensorflow and Keras API on the google colab. I use Tensorflow 2.0.0-beta1.
My code part for loss function is :
model = tf.keras.Sequential([
tf.keras.layers.Embedding(
max_features, 32,
…

Sultan Zeybek
- 33
- 1
- 8
1
vote
0 answers
Keras model doesn't train when using GradientTape
I have a class with a model inside:
class MyNetwork:
def __init__(self):
# layer initializations
self.optimizer = tf.train.RMSPropOptimizer(0.001)
self.loss = tf.losses.sigmoid_cross_entropy
def build(self):
…

Susmit Agrawal
- 3,649
- 2
- 13
- 29
1
vote
0 answers
Subclassing tf.Tensor for both Graph and Eager Execution
I would like to subclass the tf.Tensor class. The idea is that the objects of subclasses should behave like Tensors (i.e. I can use them to make any kind of tf operations) but they should also possess others attributes which provide them specific…

Giuseppe Marra
- 1,094
- 7
- 16
1
vote
0 answers
Tensorflow eager execution gets no gradients if loss not directly computed using model output
I'm not sure if this has been asked before but I am encountering a problem computing gradients with a custom loss function. I'm not quite sure how to title the question but it seems that, unless I use the model output directly in the loss…

DAV
- 736
- 6
- 24
1
vote
1 answer
Eager execution in tensorflow probability stops recording gradients at second iteration
Somehow I don't get gradients in my train loop. Below is a simple example.
import tensorflow as tf
import tensorflow_probability as tfp
tf.enable_eager_execution()
hidden_size = 32
output_size = 1
m = tf.keras.Sequential(
[
…

ritchie46
- 10,405
- 1
- 24
- 43
1
vote
1 answer
LSTM timesteps in Sonnet
I'm currently trying to learn Sonnet.
My network (incomplete, the question is based on this):
class Model(snt.AbstractModule):
def __init__(self, name="LSTMNetwork"):
super(Model, self).__init__(name=name)
with…

Susmit Agrawal
- 3,649
- 2
- 13
- 29
1
vote
0 answers
how I can convert a tensorflow model written in eager mode into a tensorflow lite
I want to convert resnet50 model (written in eager execution mode) into tflite. The mode implementation is provided here in tensorflow. It seems that tflite does not know about the block of layers (for example: _ConvBlock). I am getting error…

Azi
- 11
- 2
1
vote
1 answer
Eager Mode: Using Sequentials within tf.keras.Model
I am transitioning from Pytorch to TensorFlow 1.12 and would like to know whether it is possible to define tf.keras.Sequential classes within a tf.keras.Model and run those in eager mode.
I constructed this minimum non-working example and would be…

Carl
- 11
- 1
1
vote
1 answer
How can I inspect the contents of my tensor using TensorFlow’s eager execution?
I use TensorFlow 1.12 using eager execution, and I have the following (incomplete) function in which I want to inspect some intermediate tensor:
def parse_example(example_proto, width, height, num_classes):
features = {
'image/encoded':…
user4028648
1
vote
0 answers
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.…

tk338
- 176
- 4
- 11
1
vote
1 answer
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…

Leevo
- 1,683
- 2
- 17
- 34
1
vote
1 answer
Eager execution get trainable variables
In all the toturials (including tf official docs) that I see about tfe, The example uses the gradient tape, and manually adding all the gradients to the list of computed gradients e.g
variables = [w1, b1, w2, b2] <--- manually store all the…

DsCpp
- 2,259
- 3
- 18
- 46
1
vote
0 answers
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…

Kevin Lee
- 11
- 1
1
vote
2 answers
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…

Gary
- 823
- 1
- 8
- 14