import torch
import numpy as np print(torch.tensor([1,2,3]))
print(torch.tensor(np.arange(15).reshape(3,5)))
print(torch.empty([3,4]))
print(torch.ones([3,4]))
print(torch.zeros([3,4]))
#0-1之间的随机数
print(torch.rand([2,3]))
#3-10之间的随机整数
print(torch.randint(3,10,(2,2)))
#正态分布,均值为0,方差为1
print(torch.randn([3,4])) D:\anaconda\python.exe C:/Users/liuxinyu/Desktop/pytorch_test/day1/tensor.py
tensor([1, 2, 3])
tensor([[ 0, 1, 2, 3, 4],
[ 5, 6, 7, 8, 9],
[10, 11, 12, 13, 14]], dtype=torch.int32)
tensor([[0., 0., 0., 0.],
[0., 0., 0., 0.],
[0., 0., 0., 0.]])
tensor([[1., 1., 1., 1.],
[1., 1., 1., 1.],
[1., 1., 1., 1.]])
tensor([[0., 0., 0., 0.],
[0., 0., 0., 0.],
[0., 0., 0., 0.]])
tensor([[0.5792, 0.9149, 0.3303],
[0.6756, 0.5236, 0.0648]])
tensor([[9, 3],
[4, 7]])
tensor([[ 1.2060, -0.8728, -0.6619, 1.2589],
[-0.8896, -0.1648, -0.0978, -0.8487],
[ 0.2621, 0.9406, 0.0079, 0.0284]]) Process finished with exit code 0

  

最新文章

  1. visio二次开发——图纸解析之形状
  2. GJM : JavaScript 语言学习笔记
  3. CentOS系统操作mysql的常用命令
  4. AJAX 页面数据传递
  5. 常见面试问题 - Useful Links
  6. BZOJ 1001 [BeiJing2006] 狼抓兔子(平面图最大流)
  7. ci连贯操作的limit两个参数和sql是相反的
  8. JSON.stringify语法解析(自己留存)
  9. MVC4 Controller器同名问题
  10. linux下的php网站放到Windows服务器IIS下.htaccess文件伪静态规则转换
  11. Node.js(初识)
  12. 从C#到TypeScript - Reflect
  13. 【NOIP模拟】board(线段树维护二进制,树序号化为二进制)
  14. Archlinux 安装小计
  15. bzoj 3670: [Noi2014]动物园
  16. Vue中method与computed的区别
  17. oracle导入dmp文件的2种方法
  18. (golang)HTTP基本认证机制及使用gocolly登录爬取
  19. git常用命令总结以及用github来展示你的前端页面
  20. Replicated Ship 本地 kubernetes 环境试用

热门文章

  1. 【Redis】入门
  2. openssl与java(读取加密码的密钥)
  3. 医学图像分割-在3DSlicer中使用英伟达的AI辅助工具NvidiaAIAssistedAnnotation自动切割医学图像教程
  4. nginx代理图片上传以及访问
  5. prometheus+grafana实现监控过程的整体流程
  6. IdentityServer 部署踩坑记
  7. Sql练习201908131742
  8. 《Three.js 入门指南》3.1.1 - 基本几何形状-立方体(CubeGeometry)
  9. 用命令在本地创建github仓库
  10. 安装一个KVM服务器