๐ŸŒ
TensorFlow
tensorflow.org โ€บ tensorflow core โ€บ introduction to tensors
Introduction to Tensors | TensorFlow Core
If you need a Tensor use the tf.rank or tf.shape function. This difference is subtle, but it can be important when building graphs (later). ... While axes are often referred to by their indices, you should always keep track of the meaning of each. Often axes are ordered from global to local: The batch axis first, followed by spatial dimensions, and features for each location last. This way feature vectors are contiguous regions of memory. TensorFlow ...
๐ŸŒ
Developmentseed
developmentseed.org โ€บ tensorflow-eo-training-2 โ€บ docs โ€บ Lesson3_Intro_tensors_functions_datasets.html
Introduction to Tensors, TensorFlow Functions and TensorFlow Datasets โ€” Deep learning with TensorFlow
In this tutorial, we will learn about some key aspects of TensorFlow. First we will start by discussing tensors, tensorflowโ€™s fundamental data type. Next, weโ€™ll cover tf.function and when to use it for performance optimization and model portability.
machine learning software framework
TensorFlow is a software library for machine learning and artificial intelligence. It can be used across a range of tasks, but is used mainly for training and inference of neural networks. It โ€ฆ Wikipedia
Factsheet
Developer Google Brain Team
Release November 9, 2015; 10 years ago (2015-11-09)
Stable release 2.21.0
/ March 6, 2026; 3 months ago (2026-03-06)
Factsheet
Developer Google Brain Team
Release November 9, 2015; 10 years ago (2015-11-09)
Stable release 2.21.0
/ March 6, 2026; 3 months ago (2026-03-06)
๐ŸŒ
TensorFlow
tensorflow.org
TensorFlow
TensorFlow makes it easy to create ML models that can run in any environment.
๐ŸŒ
Medium
igormintz.medium.com โ€บ basic-tensor-creation-and-manipulation-with-tensorflow-ee4c910a00e2
Basic tensor creation and manipulation with TensorFlow | by Igor Mintz | Medium
July 7, 2023 - This blog is just a compilation of common TensorFlow methods with examples copied from the original docstrings. Intended for Tensorflow newbies. ... Creates a constant tensor from a tensor-like object.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ introduction-tensor-tensorflow
Introduction to Tensor with Tensorflow - GeeksforGeeks
December 17, 2025 - Tensor is a multi-dimensional array used to store data in machine learning and deep learning frameworks such as TensorFlow. Tensors are the fundamental data structure in TensorFlow and they represent the flow of data through a computation graph.
Find elsewhere
Top answer
1 of 4
69

TensorFlow doesn't have first-class Tensor objects, meaning that there are no notion of Tensor in the underlying graph that's executed by the runtime. Instead the graph consists of op nodes connected to each other, representing operations. An operation allocates memory for its outputs, which are available on endpoints :0, :1, etc, and you can think of each of these endpoints as a Tensor. If you have tensor corresponding to nodename:0 you can fetch its value as sess.run(tensor) or sess.run('nodename:0'). Execution granularity happens at operation level, so the run method will execute op which will compute all of the endpoints, not just the :0 endpoint. It's possible to have an Op node with no outputs (like tf.group) in which case there are no tensors associated with it. It is not possible to have tensors without an underlying Op node.

You can examine what happens in underlying graph by doing something like this

Copytf.reset_default_graph()
value = tf.constant(1)
print(tf.get_default_graph().as_graph_def())

So with tf.constant you get a single operation node, and you can fetch it using sess.run("Const:0") or sess.run(value)

Similarly, value=tf.placeholder(tf.int32) creates a regular node with name Placeholder, and you could feed it as feed_dict={"Placeholder:0":2} or feed_dict={value:2}. You can not feed and fetch a placeholder in the same session.run call, but you can see the result by attaching a tf.identity node on top and fetching that.

For variable

Copytf.reset_default_graph()
value = tf.Variable(tf.ones_initializer()(()))
value2 = value+3
print(tf.get_default_graph().as_graph_def())

You'll see that it creates two nodes Variable and Variable/read, the :0 endpoint is a valid value to fetch on both of these nodes. However Variable:0 has a special ref type meaning it can be used as an input to mutating operations. The result of Python call tf.Variable is a Python Variable object and there's some Python magic to substitute Variable/read:0 or Variable:0 depending on whether mutation is necessary. Since most ops have only 1 endpoint, :0 is dropped. Another example is Queue -- close() method will create a new Close op node which connects to Queue op. To summarize -- operations on python objects like Variable and Queue map to different underlying TensorFlow op nodes depending on usage.

For ops like tf.split or tf.nn.top_k which create nodes with multiple endpoints, Python's session.run call automatically wraps output in tuple or collections.namedtuple of Tensor objects which can be fetched individually.

2 of 4
15

From the glossary:

A Tensor is a typed multi-dimensional array. For example, a 4-D array of floating point numbers representing a mini-batch of images with dimensions [batch, height, width, channel].

Basically, every data is a Tensor in TensorFlow (hence the name):

  • placeholders are Tensors to which you can feed a value (with the feed_dict argument in sess.run())
  • Variables are Tensors which you can update (with var.assign()). Technically speaking, tf.Variable is not a subclass of tf.Tensor though
  • tf.constant is just the most basic Tensor, which contains a fixed value given when you create it

However, in the graph, every node is an operation, which can have Tensors as inputs or outputs.

๐ŸŒ
APXML
apxml.com โ€บ courses โ€บ getting-started-with-tensorflow โ€บ chapter-2-core-tensorflow-concepts โ€บ understanding-tensors
Understanding TensorFlow Tensors
Understanding tensors, their shapes, data types, and how to create and manipulate them is foundational for working with TensorFlow. They are the data containers that flow through the computational graphs you will build and execute.
๐ŸŒ
W3Schools
w3schools.com โ€บ ai โ€บ ai_tensorflow_operations.asp
TensorFlow Operations
const tensorA = tf.tensor([[1, 2], [3, 4], [5, 6]]); const tensorB = tf.tensor([[1,-1], [2,-2], [3,-3]]); // Tensor Addition const tensorNew = tensorA.add(tensorB); // Result: [ [2, 1], [5, 2], [8, 3] ]
๐ŸŒ
TensorFlow
tensorflow.org โ€บ tensorflow v2.16.1 โ€บ tensorflow::tensor class reference
tensorflow::Tensor Class Reference | TensorFlow v2.16.1
October 6, 2023 - Copy the other tensor into this tensor, reshape it and reinterpret the buffer's datatype.
๐ŸŒ
Medium
medium.com โ€บ @pedroalves_9884 โ€บ tensorflow-2-fundamentals-a-comprehensive-guide-to-tensors-and-operations-85ef463f0ed5
TensorFlow 2 Fundamentals: A Comprehensive Guide to Tensors and Operations | by Pedro Alves | Medium
July 7, 2023 - A tensor is a fundamental data structure in TensorFlow that represents multi-dimensional arrays of numerical data. Tensors can have any number of dimensions, which can range from 0 (a scalar) to higher dimensions such as 1D (a vector), 2D (a ...
๐ŸŒ
CodeSignal
codesignal.com โ€บ learn โ€บ courses โ€บ introduction-to-tensorflow-basics โ€บ lessons โ€บ understanding-the-basics-of-tensors-in-tensorflow
Understanding the Basics of Tensors in TensorFlow
In TensorFlow, we can easily create tensors using various functions, one of which is tf.constant(). This function allows us to create a tensor with fixed values. It requires at least one argument, which will be the data we are passing in.
๐ŸŒ
TensorFlow
tensorflow.org โ€บ tensorflow core โ€บ customization basics: tensors and operations
Customization basics: tensors and operations | TensorFlow Core
August 16, 2024 - Create and use tensors. Use GPU acceleration. Build a data pipeline with tf.data.Dataset. To get started, import the tensorflow module. As of TensorFlow 2, eager execution is turned on by default.
๐ŸŒ
Willogy
insights.willogy.io โ€บ tensorflow-part-1-creating-and-manipulating-tensors
Tensorflow - part 1: Creating and manipulating tensors - Willogy Insights
July 31, 2021 - Tensorflow is one of the parallel machine learning frameworks that allow us to work with tensors in an efficient way. Below are our instructions on how to construct a tensor and do operations on it.
๐ŸŒ
Wikipedia
en.wikipedia.org โ€บ wiki โ€บ TensorFlow
TensorFlow - Wikipedia
10 hours ago - TensorFlow computations are expressed as stateful dataflow graphs. The name TensorFlow derives from the operations that such neural networks perform on multidimensional data arrays, which are referred to as tensors.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ introduction-to-tensorflow
Introduction to TensorFlow - GeeksforGeeks
3 weeks ago - The architecture of TensorFlow revolves around the concept of a computational graph which is a network of nodes (operations) and edges (data). Here's a breakdown of key components: Tensors: Tensors are the fundamental units of data in TensorFlow. ...