TensorFlow教程之API DOC 6.1.8 Class tensorflow::TensorShape

简介:

本文档为TensorFlow参考文档,本转载已得到TensorFlow中文社区授权。


Class tensorflow::TensorShape

Manages the dimensions of a Tensor and their sizes.

Member Summary

Member Details

tensorflow::TensorShape::TensorShape(gtl::ArraySlice< int64 > dim_sizes)

Construct a TensorShape from the provided sizes. REQUIRES: dim_sizes[i] >= 0

tensorflow::TensorShape::TensorShape(std::initializer_list< int64 > dim_sizes)

tensorflow::TensorShape::TensorShape(const TensorShapeProto &proto)

REQUIRES: IsValid(proto)

tensorflow::TensorShape::TensorShape()

Create a tensor shape with no dimensions and one element, which you can then call AddDim() on.

void tensorflow::TensorShape::Clear()

Clear a tensor shape.

void tensorflow::TensorShape::AddDim(int64 size)

Add a dimension to the end ("inner-most"). REQUIRES: size >= 0

void tensorflow::TensorShape::AppendShape(const TensorShape &shape)

Appends all the dimensions from shape.

void tensorflow::TensorShape::InsertDim(int d, int64 size)

Insert a dimension somewhere in the TensorShape. REQUIRES: 0 <= d <= dims() REQUIRES: size >= 0

void tensorflow::TensorShape::set_dim(int d, int64 size)

Modifies the size of the dimension d to be size REQUIRES: 0 <= d < dims() REQUIRES: size >= 0

void tensorflow::TensorShape::RemoveDim(int d)

Removes dimension d from the TensorShape. REQUIRES: 0 <= d < dims()

int tensorflow::TensorShape::dims() const

Return the number of dimensions in the tensor.

int64 tensorflow::TensorShape::dim_size(int d) const

Returns the number of elements in dimension d. REQUIRES: 0 <= d < dims()

gtl::ArraySlice<int64> tensorflow::TensorShape::dim_sizes() const

Returns sizes of all dimensions.

int64 tensorflow::TensorShape::num_elements() const

Returns the number of elements in the tensor.

We use int64 and not size_t to be compatible with Eigen::Tensor which uses ptrdiff_t.

bool tensorflow::TensorShape::IsSameSize(const TensorShape &b) const

Returns true if *this and b have the same sizes. Ignores dimension names.

bool tensorflow::TensorShape::operator==(const TensorShape &b) const

void tensorflow::TensorShape::AsProto(TensorShapeProto *proto) const

Fill *proto from *this.

Eigen::DSizes< Eigen::DenseIndex, NDIMS > tensorflow::TensorShape::AsEigenDSizes() const

Fill *dsizes from *this.

Eigen::DSizes< Eigen::DenseIndex, NDIMS > tensorflow::TensorShape::AsEigenDSizesWithPadding() const

Same as AsEigenDSizes() but allows for NDIMS > dims() in which case we pad the rest of the sizes with 1.

TensorShapeIter tensorflow::TensorShape::begin() const

For iterating through the dimensions.

TensorShapeIter tensorflow::TensorShape::end() const

string tensorflow::TensorShape::DebugString() const

For error messages.

string tensorflow::TensorShape::ShortDebugString() const

static bool tensorflow::TensorShape::IsValid(const TensorShapeProto &proto)

Returns true iff proto is a valid tensor shape.

相关文章
|
2月前
|
数据采集 监控 安全
各种业务场景调用API代理的API接口教程
API代理的API接口在各种业务场景中具有广泛的应用,本文将介绍哪些业务场景可以使用API代理的API接口,并提供详细的调用教程和代码演示,同时,我们还将讨论在不同场景下使用API代理的API接口所带来的好处。
|
5月前
|
API
免费节假日api接口使用教程-聚合数据
免费节假日api接口使用教程-聚合数据
917 0
免费节假日api接口使用教程-聚合数据
|
5月前
|
机器学习/深度学习 JSON JavaScript
图文讲解 Stable Diffusion API 调用教程
Stable Diffusion 是一个先进的深度学习模型,用于创造和修改图像。这个模型能够基于文本描述来生成图像,让机器理解和实现用户的创意。使用这项技术的关键在于掌握其 API,通过编程来操控图像生成的过程。
|
17天前
|
机器学习/深度学习 API TensorFlow
TensorFlow的高级API:tf.keras深度解析
【4月更文挑战第17天】本文深入解析了TensorFlow的高级API `tf.keras`,包括顺序模型和函数式API的模型构建,以及模型编译、训练、评估和预测的步骤。`tf.keras`结合了Keras的易用性和TensorFlow的性能,支持回调函数、模型保存与加载等高级特性,助力提升深度学习开发效率。
|
2月前
|
安全 API 数据安全/隐私保护
email api接口配置教程步骤详解
Email API是用于程序化访问邮件服务的工具,让开发者能集成邮件功能到应用中。配置Email API包括选择供应商(如SendGrid、Mailgun、AokSend),注册获取API密钥,配置API参数,及测试邮件发送。使用Email API能提升邮件发送的可靠性和效率,便于邮件管理及营销活动。AokSend支持大量验证码发送,适合高效邮件运营。
|
3月前
|
存储 负载均衡 API
部署大模型API的实战教程
部署大模型API的实战教程可以分为以下步骤:
|
3月前
|
机器学习/深度学习 人工智能 API
人工智能应用工程师技能提升系列2、——TensorFlow2——keras高级API训练神经网络模型
人工智能应用工程师技能提升系列2、——TensorFlow2——keras高级API训练神经网络模型
38 0
|
5月前
|
存储 API 数据安全/隐私保护
2021年最新最全Flink系列教程__Flink高级API(四)
2021年最新最全Flink系列教程__Flink高级API(四)
36 0
|
5月前
|
消息中间件 API 数据安全/隐私保护
2021年最新最全Flink系列教程__Flink高级API(三)
2021年最新最全Flink系列教程__Flink高级API(三)
18 0
|
5月前
|
消息中间件 Kafka API
2021年最新最全Flink系列教程_Flink原理初探和流批一体API(二.五)
2021年最新最全Flink系列教程_Flink原理初探和流批一体API(二.五)
42 0