当前位置:网站首页>TensorFlow中的Tensor是什么?
TensorFlow中的Tensor是什么?
2020-11-06 20:53:00 【Alili丶前端大爆炸】
Tensor(张量)
“张量”一词最初由威廉·罗恩·哈密顿在1846年引入。对,就是那个发明四元数的哈密顿:
-
Tensor实际上就是一个多维数组(multidimensional array)
-
Tensor的目的是能够创造更高维度的矩阵、向量。
色彩的例子
彩色图像文件(RGB)一般都会处理成3-d tensor,每个2d array中的element表示一个像素,R代表Red,G代表Green,B代表Blue
多维数组
把三维张量画成一个立方体:
更高维的张量:
初始化一个向量
0维
tf.tensor(1).print();
1维
tf.tensor([1, 2, 3, 4]).print();
// or
tf.tensor1d([1, 2, 3]).print();
2维
tf.tensor([[1, 2], [3, 4]]).print();
// or
tf.tensor2d([[1, 2], [3, 4]]).print();
3维
tf.tensor([[[1], [2]], [[3], [4]]]).print();
// or
tf.tensor3d([[[1], [2]], [[3], [4]]]).print();
4维
tf.tensor([[[[1], [2]], [[3], [4]]]]).print();
// or
tf.tensor4d([[[[1], [2]], [[3], [4]]]]).print();
5维
tf.tensor([[[[[1], [2]], [[3], [4]]]]]).print();
// or
tf.tensor5d([[[[[1], [2]], [[3], [4]]]]]).print();
6维
tf.tensor([[[[[[1],[2]],[[3],[4]]],[[[5],[6]],[[7],[8]]]]]]).print();
// or
tf.tensor6d([[[[[[1],[2]],[[3],[4]]],[[[5],[6]],[[7],[8]]]]]]).print();
更多文章请关注我的博客 Alili丶前端大爆炸 订阅号:
Alili丶前端大爆炸
版权声明
本文为[Alili丶前端大爆炸]所创,转载请带上原文链接,感谢
https://my.oschina.net/u/4000748/blog/4667574
边栏推荐
- 阿里云Q2营收破纪录背后,云的打开方式正在重塑
- 至联云分享:IPFS/Filecoin值不值得投资?
- 6.5 request to view name translator (in-depth analysis of SSM and project practice)
- 6.2 handleradapter adapter processor (in-depth analysis of SSM and project practice)
- CCR炒币机器人:“比特币”数字货币的大佬,你不得不了解的知识
- Common algorithm interview has been out! Machine learning algorithm interview - KDnuggets
- vue任意关系组件通信与跨组件监听状态 vue-communication
- Let the front-end siege division develop independently from the back-end: Mock.js
- Process analysis of Python authentication mechanism based on JWT
- OPTIMIZER_ Trace details
猜你喜欢
Tool class under JUC package, its name is locksupport! Did you make it?
EOS创始人BM: UE,UBI,URI有什么区别?
ipfs正舵者Filecoin落地正当时 FIL币价格破千来了
助力金融科技创新发展,ATFX走在行业最前列
2018中国云厂商TOP5:阿里云、腾讯云、AWS、电信、联通 ...
How to use Python 2.7 after installing anaconda3?
Summary of common algorithms of binary tree
The difference between Es5 class and ES6 class
[JMeter] two ways to realize interface Association: regular representation extractor and JSON extractor
TRON智能钱包PHP开发包【零TRX归集】
随机推荐
Architecture article collection
After reading this article, I understand a lot of webpack scaffolding
Can't be asked again! Reentrantlock source code, drawing a look together!
采购供应商系统是什么?采购供应商管理平台解决方案
前端工程师需要懂的前端面试题(c s s方面)总结(二)
5.5 controlleradvice notes - SSM in depth analysis and project practice
Relationship between business policies, business rules, business processes and business master data - modern analysis
教你轻松搞懂vue-codemirror的基本用法:主要实现代码编辑、验证提示、代码格式化
5.4 static resource mapping
Linked blocking Queue Analysis of blocking queue
一篇文章带你了解SVG 渐变知识
Programmer introspection checklist
6.1.1 handlermapping mapping processor (1) (in-depth analysis of SSM and project practice)
如何玩转sortablejs-vuedraggable实现表单嵌套拖拽功能
How to encapsulate distributed locks more elegantly
6.3 handlerexceptionresolver exception handling (in-depth analysis of SSM and project practice)
[actual combat of flutter] pubspec.yaml Configuration file details
TRON智能钱包PHP开发包【零TRX归集】
Common algorithm interview has been out! Machine learning algorithm interview - KDnuggets
阿里云Q2营收破纪录背后,云的打开方式正在重塑