当前位置:网站首页>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
- 一路踩坑,被迫聊聊 C# 代码调试技巧和远程调试
- An article taught you to use HTML5 SVG tags
- 理解格式化原理
- 面试官: ShardingSphere 学一下吧
- Diamond standard
- C# 调用SendMessage刷新任务栏图标(强制结束时图标未消失)
- The method of realizing high SLO on large scale kubernetes cluster
- Analysis of serilog source code -- how to use it
- What are manufacturing and new automation technologies?
猜你喜欢

Will blockchain be the antidote to the global epidemic accelerating the transformation of Internet enterprises?

只有1个字节的文件实际占用多少磁盘空间

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

With this artifact, quickly say goodbye to spam messages

ES6 learning notes (2): teach you to play with class inheritance and class objects

Building a new generation cloud native data lake with iceberg on kubernetes

StickEngine-架构12-通信协议

Axios learning notes (2): easy to understand the use of XHR and how to package simple Axios

Git rebase is in trouble. What to do? Waiting line

Behind the first lane level navigation in the industry
随机推荐
An article will take you to understand SVG gradient knowledge
新建一个空文件占用多少磁盘空间?
es创建新的索引库并拷贝旧的索引库 实践亲测有效!
What are manufacturing and new automation technologies?
From overseas to China, rancher wants to do research on container cloud market
Vue communication and cross component listening state Vue communication
Using an example to understand the underlying processing mechanism of JS function
Building a new generation cloud native data lake with iceberg on kubernetes
Helping financial technology innovation and development, atfx is at the forefront of the industry
代码生成器插件与Creator预制体文件解析
华为云微认证考试简介
事件监听问题
Isn't data product just a report? absolutely wrong! There are university questions in this category
行为型模式之解释器模式
Share with Lianyun: is IPFs / filecoin worth investing in?
大道至简 html + js 实现最朴实的小游戏俄罗斯方块
代码重构之法——方法重构分析
An article takes you to understand CSS3 picture border
Shh! Is this really good for asynchronous events?
With this artifact, quickly say goodbye to spam messages