liveBook · Manning

Symbolic tensor

As explained in Deep Learning with R, Third Edition

A symbolic tensor is a tensor-like object that encodes the shape and data type of future data without containing actual data values.

A symbolic tensor is a tensor-like object that represents future data. It records the data's shape and data type without containing actual values, allowing a model's computation graph to be assembled before data is supplied. section 7.2.2

Building a Functional model

In a Keras Functional model, `keras_input(shape = c(3))` creates a symbolic tensor with shape `(None, 3)` and dtype `float32`. Calling a Dense layer on it returns another symbolic tensor: a 64-unit layer changes the shape to `(None, 64)`, and a final 10-unit softmax produces the model output. The `keras_model()` call then connects the symbolic inputs and outputs. section 7.2.2

Symbolic tensors make it possible to:

  • Connect layers as graph operations while postponing real data values. section 7.2.2

Symbolic and eager tensors serve different purposes. An eager tensor contains a concrete example that can be explored interactively; a symbolic tensor represents the traced inputs and intermediate values used while a dataset pipeline is built or compiled. section 11.3.1

How Deep Learning with R, Third Edition covers it

How deep it goes
Defines symbolic tensors, demonstrates shape and dtype propagation, and distinguishes them from eager tensors during dataset tracing.
Examples
Demonstrates two Dense layers, a multi-input ticket classifier, intermediate-feature reuse, and image-segmentation dataset tracing.
What it assumes
Assumes basic tensors and layers while teaching symbolic model inputs, shape propagation, and the eager-versus-symbolic distinction.
What you can do after
Builds Functional Keras models, inspect their symbolic shapes and connections, and distinguish traced pipeline values from concrete examples.
How it connects
Connects symbolic tensors to the Keras Functional API, Keras layers, computation graphs, eager tensors, and TensorFlow dataset pipelines.

Also explained in

Compare how 2 books explain symbolic tensor →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with R, Third Edition. The section links point to the parts of the book it draws on.