×
1 Choose EITC/EITCA Certificates
2 Learn and take online exams
3 Get your IT skills certified

Confirm your IT skills and competencies under the European IT Certification framework from anywhere in the world fully online.

EITCA Academy

Digital skills attestation standard by the European IT Certification Institute aiming to support Digital Society development

LOG IN TO YOUR ACCOUNT

CREATE AN ACCOUNT FORGOT YOUR PASSWORD?

FORGOT YOUR PASSWORD?

AAH, WAIT, I REMEMBER NOW!

CREATE AN ACCOUNT

ALREADY HAVE AN ACCOUNT?
EUROPEAN INFORMATION TECHNOLOGIES CERTIFICATION ACADEMY - ATTESTING YOUR PROFESSIONAL DIGITAL SKILLS
  • SIGN UP
  • LOGIN
  • INFO

EITCA Academy

EITCA Academy

The European Information Technologies Certification Institute - EITCI ASBL

Certification Provider

EITCI Institute ASBL

Brussels, European Union

Governing European IT Certification (EITC) framework in support of the IT professionalism and Digital Society

  • CERTIFICATES
    • EITCA ACADEMIES
      • EITCA ACADEMIES CATALOGUE<
      • EITCA/CG COMPUTER GRAPHICS
      • EITCA/IS INFORMATION SECURITY
      • EITCA/BI BUSINESS INFORMATION
      • EITCA/KC KEY COMPETENCIES
      • EITCA/EG E-GOVERNMENT
      • EITCA/WD WEB DEVELOPMENT
      • EITCA/AI ARTIFICIAL INTELLIGENCE
    • EITC CERTIFICATES
      • EITC CERTIFICATES CATALOGUE<
      • COMPUTER GRAPHICS CERTIFICATES
      • WEB DESIGN CERTIFICATES
      • 3D DESIGN CERTIFICATES
      • OFFICE IT CERTIFICATES
      • BITCOIN BLOCKCHAIN CERTIFICATE
      • WORDPRESS CERTIFICATE
      • CLOUD PLATFORM CERTIFICATENEW
    • EITC CERTIFICATES
      • INTERNET CERTIFICATES
      • CRYPTOGRAPHY CERTIFICATES
      • BUSINESS IT CERTIFICATES
      • TELEWORK CERTIFICATES
      • PROGRAMMING CERTIFICATES
      • DIGITAL PORTRAIT CERTIFICATE
      • WEB DEVELOPMENT CERTIFICATES
      • DEEP LEARNING CERTIFICATESNEW
    • CERTIFICATES FOR
      • EU PUBLIC ADMINISTRATION
      • TEACHERS AND EDUCATORS
      • IT SECURITY PROFESSIONALS
      • GRAPHICS DESIGNERS & ARTISTS
      • BUSINESSMEN AND MANAGERS
      • BLOCKCHAIN DEVELOPERS
      • WEB DEVELOPERS
      • CLOUD AI EXPERTSNEW
  • FEATURED
  • SUBSIDY
  • HOW IT WORKS
  •   IT ID
  • ABOUT
  • CONTACT
  • MY ORDER
    Your current order is empty.
EITCIINSTITUTE
CERTIFIED

Is eager mode automatically turned on in newer versions of TensorFlow?

by MIRNA HANŽEK / Tuesday, 04 November 2025 / Published in Artificial Intelligence, EITC/AI/GCML Google Cloud Machine Learning, Advancing in Machine Learning, TensorFlow Eager Mode

Eager execution represents a significant shift in the programming model of TensorFlow, particularly when contrasted with the original graph-based execution paradigm that characterized TensorFlow 1.x. Eager mode enables operations to execute immediately as they are called from Python. This imperative approach simplifies debugging, development, and prototyping workflows by providing an intuitive interface similar to those found in other numerical computing libraries, such as NumPy.

Beginning with TensorFlow 2.0, eager execution is indeed enabled by default. This change was introduced to streamline the user experience, making TensorFlow more accessible and Pythonic. Prior to TensorFlow 2.0, users needed to explicitly enable eager execution using the `tf.enable_eager_execution()` function at the start of their programs. This approach was necessary because TensorFlow 1.x used a static computation graph model, which required constructing a graph and then executing it within a session. While powerful for optimization and deployment, the static graph paradigm added complexity for many users, especially those new to deep learning workflows.

TensorFlow 2.x (including all subsequent minor releases such as 2.1, 2.2, etc.) fundamentally shifted to an eager-first execution model. This means that, as soon as tensors and operations are defined, their values are computed without the need to explicitly construct or execute graphs via sessions. This transition was motivated by the desire to make TensorFlow's interface more approachable and to facilitate rapid development and experimentation, which are often hindered by the ceremony associated with static graphs.

A brief example illustrates the difference between graph execution (pre-TensorFlow 2.0) and eager execution (TensorFlow 2.0 and beyond). In TensorFlow 1.x, a simple addition would look like the following:

python
import tensorflow as tf

a = tf.constant(2)
b = tf.constant(3)
c = a + b

with tf.Session() as sess:
    print(sess.run(c))  # Output: 5

In TensorFlow 2.x, the same operation, thanks to eager execution, is immediate and does not require a session:

python
import tensorflow as tf

a = tf.constant(2)
b = tf.constant(3)
c = a + b

print(c.numpy())  # Output: 5

Here, the addition operation is executed as soon as the code is run, and the result is directly available as a NumPy value using `c.numpy()`.

One practical advantage of eager execution is the simplification of debugging. As operations are executed immediately, developers can use standard Python debugging tools (such as `pdb`, breakpoints, and print statements) to inspect the state of tensors and operations. This stands in contrast to the more opaque static graph execution, where runtime errors may only manifest during session execution, often making debugging more challenging.

Despite the shift to eager execution as the default behavior, TensorFlow still retains the capability to generate and execute static graphs when necessary. This is primarily achieved via the `@tf.function` decorator. By annotating a function with `@tf.function`, TensorFlow traces the Python code and converts it into a static graph, thereby enabling optimizations and efficient deployment, especially in production environments or when targeting hardware accelerators such as TPUs. Thus, TensorFlow 2.x provides a hybrid model that balances the simplicity of eager execution with the performance benefits of static graphs. For example:

python
import tensorflow as tf

@tf.function
def add(a, b):
    return a + b

x = tf.constant(2)
y = tf.constant(3)
result = add(x, y)
print(result.numpy())  # Output: 5

This function, while appearing imperatively defined, is executed as a graph when called, enabling TensorFlow to apply graph-level optimizations.

The automatic enabling of eager execution in TensorFlow 2.x eliminates the need for the user to explicitly invoke enabling functions or configure the runtime for imperative execution. This default behavior is consistent across all platforms where TensorFlow 2.x is supported, including Google Cloud Machine Learning Engine, local environments, and various deployment targets.

It is also relevant to note that the transition to eager execution does not preclude advanced users from constructing graphs explicitly or managing execution modes where necessary for performance or backward compatibility. For most use cases, however, the default eager execution provides a more user-friendly and Pythonic environment for model development, experimentation, and debugging.

Special consideration should be given to legacy code written for TensorFlow 1.x, which may depend on session-based execution and graph construction. TensorFlow provides a compatibility module (`tf.compat.v1`) that allows users to run legacy code within the TensorFlow 2.x runtime. When using this compatibility mode, eager execution may not be enabled by default, and users may need to manage execution modes explicitly, particularly when mixing codebases or migrating from 1.x to 2.x.

New versions of TensorFlow (from 2.0 onwards) automatically enable eager execution, offering immediate evaluation of operations and a more intuitive API for most workflows. This default execution mode is integral to the TensorFlow 2.x design philosophy, aiming to reduce friction for users, enhance productivity, and maintain compatibility with advanced deployment and optimization needs through the use of `@tf.function` and other graph-based mechanisms.

Other recent questions and answers regarding TensorFlow Eager Mode:

  • How do the similarity between the source and target datasets, along with regularization techniques and the choice of learning rate, influence the effectiveness of transfer learning applied via TensorFlow Hub?
  • How does the feature extraction approach differ from fine-tuning in transfer learning with TensorFlow Hub, and in which situations is each more convenient?
  • Does the eager mode automatically turn off when moving to a new cell in the notebook?
  • Does eager mode prevent the distributed computing functionality of TensorFlow?
  • What are the disadvantages of using Eager mode rather than regular TensorFlow with Eager mode disabled?
  • How does Eager mode in TensorFlow improve efficiency and effectiveness in development?
  • What are the benefits of using Eager mode in TensorFlow for software development?
  • What is the difference between running code with and without Eager mode enabled in TensorFlow?
  • How does Eager mode in TensorFlow simplify the debugging process?
  • What is the main challenge with the TensorFlow graph and how does Eager mode address it?

More questions and answers:

  • Field: Artificial Intelligence
  • Programme: EITC/AI/GCML Google Cloud Machine Learning (go to the certification programme)
  • Lesson: Advancing in Machine Learning (go to related lesson)
  • Topic: TensorFlow Eager Mode (go to related topic)
Tagged under: Artificial Intelligence, Deep Learning, Eager Execution, Machine Learning, Python, TensorFlow
Home » Artificial Intelligence » EITC/AI/GCML Google Cloud Machine Learning » Advancing in Machine Learning » TensorFlow Eager Mode » » Is eager mode automatically turned on in newer versions of TensorFlow?

Certification Center

USER MENU

  • My Account

CERTIFICATE CATEGORY

  • EITC Certification (105)
  • EITCA Certification (9)

What are you looking for?

  • Introduction
  • How it works?
  • EITCA Academies
  • EITCI DSJC Subsidy
  • Full EITC catalogue
  • Your order
  • Featured
  •   IT ID
  • EITCA reviews (Medium publ.)
  • About
  • Contact

EITCA Academy is a part of the European IT Certification framework

The European IT Certification framework has been established in 2008 as a Europe based and vendor independent standard in widely accessible online certification of digital skills and competencies in many areas of professional digital specializations. The EITC framework is governed by the European IT Certification Institute (EITCI), a non-profit certification authority supporting information society growth and bridging the digital skills gap in the EU.
Eligibility for EITCA Academy 90% EITCI DSJC Subsidy support
90% of EITCA Academy fees subsidized in enrolment

    EITCA Academy Secretary Office

    European IT Certification Institute ASBL
    Brussels, Belgium, European Union

    EITC / EITCA Certification Framework Operator
    Governing European IT Certification Standard
    Access contact form or call +32 25887351

    Follow EITCI on X
    Visit EITCA Academy on Facebook
    Engage with EITCA Academy on LinkedIn
    Check out EITCI and EITCA videos on YouTube

    Funded by the European Union

    Funded by the European Regional Development Fund (ERDF) and the European Social Fund (ESF) in series of projects since 2007, currently governed by the European IT Certification Institute (EITCI) since 2008

    Information Security Policy | DSRRM and GDPR Policy | Data Protection Policy | Record of Processing Activities | HSE Policy | Anti-Corruption Policy | Modern Slavery Policy

    Automatically translate to your language

    Terms and Conditions | Privacy Policy
    EITCA Academy
    • EITCA Academy on social media
    EITCA Academy


    © 2008-2026  European IT Certification Institute
    Brussels, Belgium, European Union

    TOP
    CHAT WITH SUPPORT
    Do you have any questions?
    We will reply here and by email. Your conversation is tracked with a support token.