Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

TensorNetworks

Guides

  • TensorNetworks

Tech Notes

  • Building Tensor Networks
  • Contraction Paths and Execution
  • Matrix Product States
  • A Working Tour of the Symmetry Functions
  • Tensor Networks Overview
  • Young Tableaux and Tensor Symmetries

Symbols

  • ActivateTensors
  • BinaryTensorNetwork
  • BinaryTensorNetworkQ
  • CanonicalPath
  • CanonicalPathQ
  • ContractIndices
  • ContractionTree
  • EinsteinSummation
  • GreedyContractionPath
  • HookFactor
  • HookLength
  • HookLengths
  • IndexedMultiply
  • InitializeTensorNetwork
  • MetricTensor
  • MetricTensorQ
  • MPSCanonicalForm
  • MPSCanonicalQ
  • MPSEntanglementEntropy
  • MPSNormalize
  • MPSNorm
  • MPSOverlap
  • MPSSchmidtValues
  • MPSTruncate
  • OptimalContractionPath
  • PartitionQ
  • PathIndexContractions
  • PathQ
  • PathToTreePath
  • RandomTensorNetwork
  • SchurDimension
  • SparseTensorNetwork
  • TableauColumns
  • TableauDimension
  • TableauRows
  • TableauShape
  • TableauSize
  • TableauWeylDimension
  • TensorNetworkAdd
  • TensorNetworkContraction
  • TensorNetworkContractions
  • TensorNetworkContract
  • TensorNetworkData
  • TensorNetworkDelete
  • TensorNetworkFreeIndices
  • TensorNetworkGraphData
  • TensorNetworkGraphQ
  • TensorNetworkIndexDimensions
  • TensorNetworkIndexGraph
  • TensorNetworkIndices
  • TensorNetwork
  • TensorNetworkQ
  • TensorNetworkRemoveCycles
  • TensorNetworkReplaceIndices
  • TensorNetworkSize
  • TensorNetworkTensors
  • TensorNetworkToNetGraph
  • ToTensorNetworkGraph
  • TransposePartition
  • TreePathQ
  • TreePathToPath
  • YoungProject
  • YoungSymmetrize
  • YoungTableau
  • YoungTableauQ
Wolfram`TensorNetworks`
TensorNetworkQ
​
TensorNetworkQ
[tn]
yields
True
if
tn
is a valid
TensorNetwork
object, and
False
otherwise.
​
Details and Options
▪
TensorNetworkQ
returns
True
only when the head of
tn
is
TensorNetwork
and its tensors, hyperedges, and output specification are internally consistent; any other head yields
False
.
▪
Internal consistency requires three conditions on a
TensorNetwork
[
tensors
,
hyperedges
,
output
] expression: the length of
tensors
must equal the length of
hyperedges
; each tensor's rank must equal the length of its hyperedge list; and every occurrence of a shared index must report the same dimension.
▪
When
output
is not
Automatic
, every entry of
output
must also appear in some hyperedge.
▪
TensorNetworkQ
caches the validation result via
System`Private`HoldValidQ
: an unvalidated
TensorNetwork
[…] expression is checked once on first evaluation; if the check passes,
System`Private`HoldSetValid
marks the expression and
System`Private`HoldSetNoEntry
freezes its argument slots, so subsequent calls short-circuit without re-validating.
▪
Property dispatch on a
TensorNetwork
object is guarded by
TensorNetworkQ
:
tn["Property"]
only evaluates when
tn
satisfies
TensorNetworkQ
, so an invalid
TensorNetwork
[…] expression is left unevaluated rather than returning a wrong answer.
​
Examples  
(11)
Basic Examples  
(1)
Test whether an expression is a valid tensor network:
In[1]:=
TensorNetworkQ

TensorNetwork
[{RandomReal[{-1,1},{2,3}],RandomReal[{-1,1},{3,4}]},{{i,j},{j,k}}]
Out[1]=
True
A network produced by RandomTensorNetwork is valid by construction:
In[2]:=
SeedRandom[42];​​mps=
RandomTensorNetwork
["MPS"[4,2,2]];​​
TensorNetworkQ
[mps]
Out[2]=
True
Anything whose head is not TensorNetwork is rejected:
In[3]:=
TensorNetworkQ
[{1,2,3}]
Out[3]=
False
Scope  
(6)

Applications  
(1)

Properties & Relations  
(3)

SeeAlso
TensorNetwork
 
▪
BinaryTensorNetworkQ
 
▪
TensorNetworkGraphQ
 
▪
RandomTensorNetwork
 
▪
TensorNetworkContract
 
▪
MatrixQ
 
▪
GraphQ
 
▪
AssociationQ
TechNotes
▪
Building Tensor Networks
RelatedGuides
▪
TensorNetworks
""

© 2026 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com