当前位置:网站首页>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
边栏推荐
- 6.3 handlerexceptionresolver exception handling (in-depth analysis of SSM and project practice)
- Natural language processing - BM25 commonly used in search
- 一篇文章带你了解CSS3 背景知识
- Wiremock: a powerful tool for API testing
- htmlcss
- 6.1.2 handlermapping mapping processor (2) (in-depth analysis of SSM and project practice)
- Network security engineer Demo: the original * * is to get your computer administrator rights! 【***】
- Calculation script for time series data
- EOS创始人BM: UE,UBI,URI有什么区别?
- ipfs正舵者Filecoin落地正当时 FIL币价格破千来了
猜你喜欢
Subordination judgment in structured data
一篇文章带你了解CSS对齐方式
Using Es5 to realize the class of ES6
一篇文章教会你使用HTML5 SVG 标签
合约交易系统开发|智能合约交易平台搭建
What is the side effect free method? How to name it? - Mario
Use of vuepress
小程序入门到精通(二):了解小程序开发4个重要文件
From zero learning artificial intelligence, open the road of career planning!
Face to face Manual Chapter 16: explanation and implementation of fair lock of code peasant association lock and reentrantlock
随机推荐
Classical dynamic programming: complete knapsack problem
Process analysis of Python authentication mechanism based on JWT
Mac installation hanlp, and win installation and use
前端都应懂的入门基础-github基础
速看!互联网、电商离线大数据分析最佳实践!(附网盘链接)
Computer TCP / IP interview 10 even asked, how many can you withstand?
使用 Iceberg on Kubernetes 打造新一代云原生数据湖
Vue.js Mobile end left slide delete component
[JMeter] two ways to realize interface Association: regular representation extractor and JSON extractor
TRON智能钱包PHP开发包【零TRX归集】
Examples of unconventional aggregation
IPFS/Filecoin合法性:保护个人隐私不被泄露
6.6.1 localeresolver internationalization parser (1) (in-depth analysis of SSM and project practice)
What to do if you are squeezed by old programmers? I don't want to quit
This article will introduce you to jest unit test
If PPT is drawn like this, can the defense of work report be passed?
From zero learning artificial intelligence, open the road of career planning!
6.3 handlerexceptionresolver exception handling (in-depth analysis of SSM and project practice)
React design pattern: in depth understanding of react & Redux principle
htmlcss