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.

相关文章
|
1月前
|
JSON 数据可视化 API
Python 中调用 DeepSeek-R1 API的方法介绍,图文教程
本教程详细介绍了如何使用 Python 调用 DeepSeek 的 R1 大模型 API,适合编程新手。首先登录 DeepSeek 控制台获取 API Key,安装 Python 和 requests 库后,编写基础调用代码并运行。文末包含常见问题解答和更简单的可视化调用方法,建议收藏备用。 原文链接:[如何使用 Python 调用 DeepSeek-R1 API?](https://apifox.com/apiskills/how-to-call-the-deepseek-r1-api-using-python/)
|
1月前
|
人工智能 API 开发工具
【重磅发布】 免费领取阿里云百炼AI大模型100万Tokens教程出炉,API接口实战操作,DeepSeek-R1满血版即刻体验!
阿里云百炼是一站式大模型开发及应用构建平台,支持开发者和业务人员轻松设计、构建大模型应用。通过简单操作,用户可在5分钟内开发出大模型应用或在几小时内训练专属模型,专注于创新。
686 89
【重磅发布】 免费领取阿里云百炼AI大模型100万Tokens教程出炉,API接口实战操作,DeepSeek-R1满血版即刻体验!
|
1月前
|
机器学习/深度学习 人工智能 Serverless
👉「免费满血DeepSeek实战-联网搜索×Prompt秘籍|暨6平台横评」
满血 DeepSeek 免费用!支持联网搜索!创作声明:真人攥写-非AI生成,Written-By-Human-Not-By-AI
2832 10
👉「免费满血DeepSeek实战-联网搜索×Prompt秘籍|暨6平台横评」
|
1月前
|
缓存 自然语言处理 安全
快速调用 Deepseek API!【超详细教程】
Deepseek 强大的功能,在本教程中,将指导您如何获取 DeepSeek API 密钥,并演示如何使用该密钥调用 DeepSeek API 以进行调试。
|
1月前
|
存储 人工智能 安全
如何调用 DeepSeek-R1 API ?图文教程
首先登录 DeepSeek 开放平台,创建并保存 API Key。接着,在 Apifox 中设置环境变量,导入 DeepSeek 提供的 cURL 并配置 Authorization 为 `Bearer {{API_KEY}}`。通过切换至正式环境发送请求,可实现对话功能,支持流式或整体输出。
2025 15
|
3月前
|
网络协议 API
检测指定TCP端口开放状态免费API接口教程
此API用于检测指定TCP端口是否开放,支持POST/GET请求。需提供用户ID、KEY、目标主机,可选指定端口(默认80)和地区(默认国内)。返回状态码、信息提示、检测主机、端口及状态(开放或关闭)。示例中ID和KEY为公共测试用,建议使用个人ID和KEY以享受更高调用频率。
96 14
|
3月前
|
API
获取网页状态码[可指定地域]免费API接口教程
该接口用于获取指定网址的访问状态码,支持从国内、香港、美国等地域节点访问。通过POST或GET请求,需提供用户ID、KEY及目标网址等参数。返回结果包括状态码和信息提示。 示例:https://cn.apihz.cn/api/wangzhan/getcode.php?id=88888888&key=88888888&type=1&url=www.apihz.cn。
|
3月前
|
缓存 算法 API
查询域名WHOIS信息免费API接口教程
该API用于查询顶级域名的WHOIS信息,不支持国别域名和中文域名。通过POST或GET请求,需提供用户ID、KEY及待查询域名。返回信息包括域名状态、注册商、时间等详细数据。示例与文档见官网。
|
3月前
|
API
icp备案查询免费API接口教程
该接口用于查询指定域名的ICP备案信息,支持POST或GET请求方式。请求时需提供用户ID、用户KEY及待查询的域名,可选参数为查询通道。响应中包含状态码、消息内容、备案号、备案主体、域名及审核时间等信息。示例中提供了GET和POST请求方式及返回数据样例。
|
3月前
|
前端开发 JavaScript API
提取网页所有链接免费API接口教程
此API用于提取指定网页内的所有链接信息并进行分类,支持POST和GET请求方式。需提供用户ID、KEY及目标网址等参数,可选指定访问节点。返回结果包括状态码、信息提示及各类链接集合,如图片、视频、文档等。示例中展示了请求格式与返回数据结构。

热门文章

最新文章