当前位置:网站首页>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
边栏推荐
- Mongodb (from 0 to 1), 11 days mongodb primary to intermediate advanced secret
- Flink的DataSource三部曲之二:内置connector
- The road of C + + Learning: from introduction to mastery
- 一篇文章带你了解CSS3 背景知识
- Python crawler actual combat details: crawling home of pictures
- Vue.js Mobile end left slide delete component
- The choice of enterprise database is usually decided by the system architect - the newstack
- Windows 10 tensorflow (2) regression analysis of principles, deep learning framework (gradient descent method to solve regression parameters)
- 助力金融科技创新发展,ATFX走在行业最前列
- 5.5 controlleradvice notes - SSM in depth analysis and project practice
猜你喜欢
Filecoin最新动态 完成重大升级 已实现四大项目进展!
一篇文章教会你使用HTML5 SVG 标签
Linked blocking Queue Analysis of blocking queue
2018中国云厂商TOP5:阿里云、腾讯云、AWS、电信、联通 ...
Network security engineer Demo: the original * * is to get your computer administrator rights! 【***】
Using Es5 to realize the class of ES6
Brief introduction and advantages and disadvantages of deepwalk model
Arrangement of basic knowledge points
一篇文章带你了解CSS3圆角知识
Grouping operation aligned with specified datum
随机推荐
I think it is necessary to write a general idempotent component
ES6学习笔记(五):轻松了解ES6的内置扩展对象
How to use Python 2.7 after installing anaconda3?
6.1.2 handlermapping mapping processor (2) (in-depth analysis of SSM and project practice)
至联云解析:IPFS/Filecoin挖矿为什么这么难?
2018中国云厂商TOP5:阿里云、腾讯云、AWS、电信、联通 ...
Vuejs development specification
Subordination judgment in structured data
Save the file directly to Google drive and download it back ten times faster
Mongodb (from 0 to 1), 11 days mongodb primary to intermediate advanced secret
Skywalking series blog 5-apm-customize-enhance-plugin
前端基础牢记的一些操作-Github仓库管理
“颜值经济”的野望:华熙生物净利率六连降,收购案遭上交所问询
Arrangement of basic knowledge points
Filecoin最新动态 完成重大升级 已实现四大项目进展!
Can't be asked again! Reentrantlock source code, drawing a look together!
Wiremock: a powerful tool for API testing
Flink的DataSource三部曲之二:内置connector
use Asponse.Words Working with word templates
[JMeter] two ways to realize interface Association: regular representation extractor and JSON extractor