tensorflow::TensorShape

#include <tensor_shape.h>

Represents the shape of a Tensor.

Summary

A tensor's shape is denoted by its number of dimensions and a size for each dimension. For example, a Tensor represented by a 3 x 4 matrix would have a shape of 2-D, [3,4].

If you know the exact shape of your Tensor when you create the TensorShape object, you can specify it then, or you can create a TensorShape with zero dimensions and one element, and call AddDim() to add dimensions later.

Constructors and Destructors

TensorShape(gtl::ArraySlice< int64 > dim_sizes)
Construct a TensorShape from the provided sizes.
TensorShape(std::initializer_list< int64 > dim_sizes)
TensorShape(const TensorShapeProto & proto)
REQUIRES: IsValid(proto)
TensorShape()
Create a tensor shape with no dimensions and one element, which you can then call AddDim() on.
TensorShape(const TensorShape & b)
Copy the specified shape.
TensorShape(TensorShape && b)
Move the specified shape. After moving, is safe for destruction and.
~TensorShape()

Public attributes

buf[16]
uint8
unused_aligner
Rep64 *

Public functions

AddDim(int64 size)
void
Add a dimension to the end ("inner-most").
AppendShape(const TensorShape & shape)
void
Appends all the dimensions from shape.
AsEigenDSizes() const
Eigen::DSizes< Eigen::DenseIndex, NDIMS >
Fill *dsizes from *this.
AsEigenDSizesWithPadding() const
Eigen::DSizes< Eigen::DenseIndex, NDIMS >
Same as AsEigenDSizes() but allows for NDIMS > dims() in which case we pad the rest of the sizes with 1.
AsProto(TensorShapeProto *proto) const
void
Fill *proto from *this.
Clear()
void
Clear a tensor shape.
DebugString() const
string
For error messages.
DumpRep() const
void
InsertDim(int d, int64 size)
void
Insert a dimension somewhere in the TensorShape.
IsSameSize(const TensorShape & b) const
bool
Returns true if *this and b have the same sizes.