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.

相关文章
|
10月前
|
人工智能 数据可视化 测试技术
Postman 性能测试教程:快速上手 API 压测
本文介绍API上线后因高频调用导致服务器告警,通过Postman与Apifox进行压力测试排查性能瓶颈。对比两款工具在批量请求、断言验证、可视化报告等方面的优劣,探讨API性能优化策略及行业未来发展方向。
Postman 性能测试教程:快速上手 API 压测
|
JSON 监控 API
在线网络PING接口检测服务器连通状态免费API教程
接口盒子提供免费PING检测API,可测试域名或IP的连通性与响应速度,支持指定地域节点,适用于服务器运维和网络监控。
2058 0
|
JSON API PHP
通用图片搜索API:百度源免费接口教程
本文介绍一款基于百度图片搜索的免费API接口,由接口盒子提供。支持关键词搜索,具备详细请求与返回参数说明,并提供PHP及Python调用示例。开发者可快速集成实现图片搜索功能,适用于内容聚合、素材库建设等场景。
2034 0
|
JSON 机器人 API
随机昵称网名API接口教程:轻松获取百万创意昵称库
接口盒子提供随机昵称网名API,拥有百万级中文昵称库,支持聊天机器人、游戏角色等场景的昵称生成。提供详细调用指南及多语言示例代码,助力开发者高效集成。
988 0
|
10月前
|
人工智能 API 开发者
图文教程:阿里云百炼API-KEY获取方法,亲测全流程
本文详细介绍了如何获取阿里云百炼API-KEY,包含完整流程与截图指引。需先开通百炼平台及大模型服务,再通过控制台创建并复制API-KEY。目前平台提供千万tokens免费额度,适合开发者快速上手使用。
6821 5
|
JSON API PHP
天气预报免费API接口【地址查询版】使用教程
本文介绍了如何使用中国气象局官方数据提供的免费天气预报API接口,通过省份和地点查询指定地区当日天气信息。该接口由接口盒子支持,提供JSON格式数据、GET/POST请求方式,并需注册获取用户ID和KEY进行身份验证。
5958 2
|
JSON API PHP
ICP备案查询免费API接口使用教程
本文介绍如何通过接口盒子提供的免费API接口查询域名ICP备案信息,包含请求地址、参数说明及PHP和Python调用示例,适用于开发者快速集成备案查询功能。
1001 1
|
存储 JSON API
文本存储免费API接口教程
接口盒子提供免费文本存储服务,支持1000条记录,每条最多5000字符,适用于公告、日志、配置等场景,支持修改与读取。
369 0
|
数据采集 JSON 监控
获取网页状态码(可指定地域)免费API接口教程
本文介绍如何使用接口盒子的免费API获取网页状态码,支持国内、香港、美国等不同地域访问节点。内容包括接口参数、调用方法及示例,适用于网站监控、链接检查等场景。
851 0
|
JSON 物联网 API
天气预报免费API接口【IP查询版】使用教程
IP查询天气API是一款免费实用的接口,可根据IP地址自动获取所在地天气预报,支持自定义IP查询。核心功能包括自动识别请求IP、全国IP天气查询,数据源自中国气象局,无日调用上限。提供详细的返回参数及多语言示例代码,适用于网站、APP、物联网设备等应用场景。
4619 0