class boulderopal.graph.Tensor(operation, shape)

A multi-dimensional array of data.

Most functions accepting a Tensor object can alternatively accept a NumPy array.

You can use the arithmetic operators +, -, *, **, /, //, and @ to perform operations between two Tensor objects.


  • shape (tuple) – The shape of the tensor.
  • name (str) – The name assigned to the node.


Graph.tensor : Create a real or complex Tensor with the data provided.


The value of a Tensor node can be fetched in a graph calculation by adding its name in the output_node_names parameter for the function call. This will add an item to the output dictionary in the calculation result object, whose key is name. The item’s value will be a dictionary with the “value” of the Tensor as a NumPy array.

Was this useful?