当前位置:网站首页>What is the tensor in tensorflow?
What is the tensor in tensorflow?
2020-11-06 20:53:00 【Python advanced】
Tensor( tensor )
“ tensor ” The word was originally used by William · Ron · Hamilton is in 1846 In introducing . Yes , It's the Hamilton who invented quaternion :

-
Tensor It's actually a multidimensional array (multidimensional array)
-
Tensor The goal is to be able to create a higher dimensional matrix 、 vector .

An example of color
Color image file (RGB) It's usually handled as 3-d tensor, Every 2d array Medium element Represents a pixel ,R representative Red,G representative Green,B representative Blue

Multidimensional arrays

Draw a cube in three dimensions :

Higher dimensional tensors :

Initialize a vector
0 dimension
tf.tensor(1).print();
1 dimension
tf.tensor([1, 2, 3, 4]).print();
// or
tf.tensor1d([1, 2, 3]).print();
2 dimension
tf.tensor([[1, 2], [3, 4]]).print();
// or
tf.tensor2d([[1, 2], [3, 4]]).print();
3 dimension
tf.tensor([[[1], [2]], [[3], [4]]]).print();
// or
tf.tensor3d([[[1], [2]], [[3], [4]]]).print();
4 dimension
tf.tensor([[[[1], [2]], [[3], [4]]]]).print();
// or
tf.tensor4d([[[[1], [2]], [[3], [4]]]]).print();
5 dimension
tf.tensor([[[[[1], [2]], [[3], [4]]]]]).print();
// or
tf.tensor5d([[[[[1], [2]], [[3], [4]]]]]).print();
6 dimension
tf.tensor([[[[[[1],[2]],[[3],[4]]],[[[5],[6]],[[7],[8]]]]]]).print();
// or
tf.tensor6d([[[[[[1],[2]],[[3],[4]]],[[[5],[6]],[[7],[8]]]]]]).print();
For more articles, please follow my blog Alili The big bang at the front end Subscription number :
Alili The big bang at the front end
版权声明
本文为[Alili, front end big bang]所创,转载请带上原文链接,感谢
边栏推荐
- GitHub: the foundation of the front end
- 事件监听问题
- With this artifact, quickly say goodbye to spam messages
- [efficiency optimization] Nani? Memory overflow again?! It's time to sum up the wave!!
- To Lianyun analysis: why is IPFs / filecoin mining so difficult?
- Asp.Net Core learning notes: Introduction
- Application of restful API based on MVC
- How to turn data into assets? Attracting data scientists
- Share with Lianyun: is IPFs / filecoin worth investing in?
- Behind the first lane level navigation in the industry
猜你喜欢

An article will take you to understand CSS3 fillet knowledge

jenkins安装部署过程简记

Using an example to understand the underlying processing mechanism of JS function

For a while, a dynamic thread pool was created, and the source code was put into GitHub

华为Mate 40 系列搭载HMS有什么亮点?

An article will take you to understand SVG gradient knowledge

Markdown tricks

面试官: ShardingSphere 学一下吧

Description of phpshe SMS plug-in

How to understand Python iterators and generators?
随机推荐
EOS founder BM: what's the difference between UE, UBI and URI?
Git rebase is in trouble. What to do? Waiting line
行为型模式之解释器模式
【字节跳动 秋招岗位开放啦】Ohayoo!放学别走,我想约你做游戏!!!
What are the common problems of DTU connection
To Lianyun analysis: why is IPFs / filecoin mining so difficult?
Even liver three all night, jvm77 high frequency interview questions detailed analysis, this?
Pn8162 20W PD fast charging chip, PD fast charging charger scheme
nacos、ribbon和feign的簡明教程
大数据处理黑科技:揭秘PB级数仓GaussDB(DWS) 并行计算技术
How to turn data into assets? Attracting data scientists
Gather in Beijing! The countdown to openi 2020
An article will introduce you to HTML tables and their main attributes
Axios learning notes (2): easy to understand the use of XHR and how to package simple Axios
An article will introduce you to CSS3 background knowledge
What are Devops
An article taught you to use HTML5 SVG tags
C# 调用SendMessage刷新任务栏图标(强制结束时图标未消失)
Swagger 3.0 brushes the screen every day. Does it really smell good?
es创建新的索引库并拷贝旧的索引库 实践亲测有效!