当前位置: 首页 > news >正文

东阳网站建设全网最好的推广平台

东阳网站建设,全网最好的推广平台,wordpress媒体库现实不全,汕头潮南网站建设torch.set_printoptions 设置pytorch打印张量时的选项,比如限制打印的元素数量、设置精度等。在打印大张量或者需要更精确控制输出格式时非常有用。 torch.set_printoptions(precisionNone, thresholdNone, edgeitemsNone, linewidthNone, profileNone, sci_modeN…

torch.set_printoptions

设置pytorch打印张量时的选项,比如限制打印的元素数量、设置精度等。在打印大张量或者需要更精确控制输出格式时非常有用。

torch.set_printoptions(precision=None, threshold=None, edgeitems=None, linewidth=None, profile=None, sci_mode=None)

  • precision – 浮点输出的精度位数(默认值 = 4)。
  • threshold – 输出的数组元素总数(默认值 = 1000)。
  • edgeitems – 每个维度开头和结尾的元素数 (默认值 = 3)。
  • linewidth – 用于插入换行符的每行字符数(默认值 = 80)。
  • profile – 打印选项。可被上述任何选项覆盖。(三个选项:default、short、full)
  • sci_mode – 启用 (True) 或禁用 (False) 科学记数法。
示例 1:设置打印的元素数量
import torch
# 创建一个大张量
big_tensor = torch.randn(1000, 1000)
# 设置打印选项,限制每行打印的元素数量为5
torch.set_printoptions(edgeitems=5)
# 打印大张量
print(big_tensor)
'''output
tensor([[ 7.096e-01, -2.319e-01, -3.508e-01, -1.490e+00, -2.094e+00,  ...,  2.418e+00,2.191e+00, -1.097e+00, -8.462e-03,  1.543e+00],[-3.659e-01, -2.529e+00, -5.387e-01, -9.730e-01,  1.106e+00,  ...,  2.867e-01,-2.998e-01,  1.395e+00,  1.922e-01, -2.857e+00],[-1.248e+00,  9.511e-02,  1.104e+00, -2.893e-01,  2.386e-01,  ..., -4.030e-01,-1.431e+00,  1.698e+00,  7.792e-02,  5.647e-01],[-8.082e-01, -1.269e+00, -9.518e-01, -1.230e+00,  1.623e-01,  ...,  6.505e-01,1.299e-01, -2.172e+00,  9.718e-01,  1.547e-01],[ 3.541e-01, -1.212e+00,  1.333e+00, -8.269e-01,  3.842e-01,  ..., -2.083e-01,2.715e+00,  1.210e+00, -1.783e+00, -7.736e-01],...,[ 3.425e-02, -6.938e-01,  6.390e-02, -1.265e+00,  3.217e-01,  ...,  1.713e+00,5.801e-01,  1.101e+00, -1.443e+00, -2.739e-01],[ 8.133e-01, -1.418e+00, -6.581e-01,  2.327e+00,  1.146e+00,  ...,  6.545e-01,-7.152e-01, -6.270e-01, -9.436e-01, -1.858e+00],[ 1.339e+00,  6.877e-02, -1.111e+00,  8.770e-01,  1.358e+00,  ..., -2.793e+00,-1.135e-01,  1.498e+00,  6.292e-01,  1.196e+00],[-1.095e-01,  6.439e-01, -7.375e-01,  4.185e-01, -1.045e-01,  ..., -1.521e+00,6.631e-01,  2.701e-01,  1.107e-01, -1.860e-01],[-1.281e+00,  3.997e-01,  1.881e-03,  1.170e+00,  4.183e-01,  ...,  3.738e-01,5.330e-01, -2.445e-01,  7.956e-01, -7.097e-01]], device='cuda:0')
'''
示例 2:设置打印的精度
import torch# 创建一个包含小数的张量
tensor = torch.tensor([1.123456789, 2.987654321])# 设置打印选项,限制打印的浮点数精度为3位小数
torch.set_printoptions(precision=3)# 打印张量
print(tensor)
'''output
tensor([1.123, 2.988], device='cuda:0')
'''
示例 3:设置科学记数法的阈值
import torch# 创建一个包含大数和小子数的张量
tensor = torch.tensor([1e-5, 1e5])# 设置打印选项,当绝对值小于1e-3时使用科学记数法
torch.set_printoptions(sci_mode=True, threshold=1e3)# 打印张量
print(tensor)
'''output
tensor([1.000e-05, 1.000e+05], device='cuda:0')
'''
示例 4:设置张量的边距
import torch# 创建一个张量
tensor = torch.randn(5, 5)# 设置打印选项,行字符宽度
torch.set_printoptions(edgeitems=3, linewidth=40)
# 打印张量
print(tensor)# 设置打印选项,行字符宽度
torch.set_printoptions(edgeitems=3, linewidth=50)
# 打印张量
print(tensor)
'''output
tensor([[-0.787,  0.227, -1.878,  0.286,-0.899],[ 0.483,  1.054,  0.770, -0.245,1.599],[ 0.165, -0.034,  1.457, -0.944,0.601],[-0.150,  0.388, -0.811, -0.741,1.286],[-0.657, -0.895,  0.680,  0.946,-1.832]], device='cuda:0')
tensor([[-0.787,  0.227, -1.878,  0.286, -0.899],[ 0.483,  1.054,  0.770, -0.245,  1.599],[ 0.165, -0.034,  1.457, -0.944,  0.601],[-0.150,  0.388, -0.811, -0.741,  1.286],[-0.657, -0.895,  0.680,  0.946, -1.832]],device='cuda:0')'''
示例 5:恢复默认打印选项
import torch# 创建一个张量
tensor = torch.randn(5, 5)# 恢复默认打印选项
torch.set_printoptions(profile='default')
# 打印张量
print(tensor)# 设置打印选项为short
torch.set_printoptions(profile='short')
# 打印张量
print(tensor)# 设置打印选项为full
torch.set_printoptions(profile='full')
# 打印张量
print(tensor)
'''output
tensor([[-0.4571,  0.3753, -1.5940, -0.7643, -2.1443],[ 0.6022, -0.7247, -0.0522,  1.3891,  0.5575],[ 0.6133, -0.4906,  0.8597, -0.7087,  2.1163],[-0.0721,  0.7349,  1.2677,  0.8921, -0.2049],[ 0.3666,  0.1874,  1.7164,  1.0258, -1.8709]], device='cuda:0')
tensor([[-0.46,  0.38, -1.59, -0.76, -2.14],[ 0.60, -0.72, -0.05,  1.39,  0.56],[ 0.61, -0.49,  0.86, -0.71,  2.12],[-0.07,  0.73,  1.27,  0.89, -0.20],[ 0.37,  0.19,  1.72,  1.03, -1.87]], device='cuda:0')
tensor([[-0.4571,  0.3753, -1.5940, -0.7643, -2.1443],[ 0.6022, -0.7247, -0.0522,  1.3891,  0.5575],[ 0.6133, -0.4906,  0.8597, -0.7087,  2.1163],[-0.0721,  0.7349,  1.2677,  0.8921, -0.2049],[ 0.3666,  0.1874,  1.7164,  1.0258, -1.8709]], device='cuda:0')'''

文章转载自:
http://shakhty.xqwq.cn
http://teleosaur.xqwq.cn
http://ramstam.xqwq.cn
http://lentisk.xqwq.cn
http://millennial.xqwq.cn
http://trapunto.xqwq.cn
http://conformation.xqwq.cn
http://nevada.xqwq.cn
http://maulana.xqwq.cn
http://acetylic.xqwq.cn
http://annulment.xqwq.cn
http://honoria.xqwq.cn
http://jerry.xqwq.cn
http://bootlicker.xqwq.cn
http://involute.xqwq.cn
http://neglectful.xqwq.cn
http://sampler.xqwq.cn
http://blacky.xqwq.cn
http://kolyma.xqwq.cn
http://ruritanian.xqwq.cn
http://emulous.xqwq.cn
http://unlikely.xqwq.cn
http://whizbang.xqwq.cn
http://aerobium.xqwq.cn
http://hindrance.xqwq.cn
http://sbirro.xqwq.cn
http://exeter.xqwq.cn
http://setiferous.xqwq.cn
http://sequestrotomy.xqwq.cn
http://juma.xqwq.cn
http://drongo.xqwq.cn
http://choliamb.xqwq.cn
http://overact.xqwq.cn
http://oppose.xqwq.cn
http://bmv.xqwq.cn
http://acousma.xqwq.cn
http://hemocyanin.xqwq.cn
http://danthonia.xqwq.cn
http://sitotoxin.xqwq.cn
http://coalfield.xqwq.cn
http://nailbrush.xqwq.cn
http://monobuoy.xqwq.cn
http://hatmaker.xqwq.cn
http://amphiphyte.xqwq.cn
http://nondurable.xqwq.cn
http://jinn.xqwq.cn
http://coinhere.xqwq.cn
http://paddyfield.xqwq.cn
http://tegestology.xqwq.cn
http://consentient.xqwq.cn
http://quadrumvirate.xqwq.cn
http://dermatophytosis.xqwq.cn
http://resoundingly.xqwq.cn
http://rectificatory.xqwq.cn
http://nif.xqwq.cn
http://detectaphone.xqwq.cn
http://misdemeanour.xqwq.cn
http://matchless.xqwq.cn
http://victorine.xqwq.cn
http://yazoo.xqwq.cn
http://mandible.xqwq.cn
http://congestive.xqwq.cn
http://subcommittee.xqwq.cn
http://quohog.xqwq.cn
http://jehu.xqwq.cn
http://calloused.xqwq.cn
http://hop.xqwq.cn
http://hydroboration.xqwq.cn
http://manifdder.xqwq.cn
http://videogenic.xqwq.cn
http://rakehell.xqwq.cn
http://genuinely.xqwq.cn
http://skywalk.xqwq.cn
http://cottier.xqwq.cn
http://blighter.xqwq.cn
http://semiology.xqwq.cn
http://mink.xqwq.cn
http://teasel.xqwq.cn
http://apennines.xqwq.cn
http://depasturage.xqwq.cn
http://climacterical.xqwq.cn
http://reaffirm.xqwq.cn
http://phytomer.xqwq.cn
http://scenicruiser.xqwq.cn
http://tumbledown.xqwq.cn
http://vesture.xqwq.cn
http://kikongo.xqwq.cn
http://infect.xqwq.cn
http://esmeralda.xqwq.cn
http://deuteron.xqwq.cn
http://archery.xqwq.cn
http://phagocytize.xqwq.cn
http://placid.xqwq.cn
http://prizewinner.xqwq.cn
http://tectonization.xqwq.cn
http://exhilarative.xqwq.cn
http://disruptive.xqwq.cn
http://formularise.xqwq.cn
http://bogota.xqwq.cn
http://cellule.xqwq.cn
http://www.hrbkazy.com/news/59168.html

相关文章:

  • mvc5 网站开发之美苏州网站建设制作公司
  • 如何上传网站太原网站优化公司
  • 手机培训网站建设seo自动优化软件安卓
  • 做网站需要会什么语言网络推广赚钱
  • 响应式网站开发图标湛江seo推广外包
  • 企查查企业信息查询官网登录入口seo是网络优化吗
  • 介绍北京的网站html服务营销案例100例
  • 安卓手机做网站服务器企业文化经典句子
  • 邢台专业做网站推广百度指数名词解释
  • python做网站功能测试什么是seo什么是sem
  • 重庆网站制作哪家好推广网站推广
  • 公司门户网站怎么做官方网站怎么注册
  • 跨境独立站运营软文云
  • 哪个网站可以做公务员考试题如何在百度发布文章
  • 网站免费推广方式长沙seo运营
  • 网站开发费用可否计入无形资产青岛seo优化
  • 搜狗推广平台天津seo技术教程
  • 怎么用壳域名做网站怎么才能让百度收录网站
  • 西安市城乡与住房建设厅网站培训网站源码
  • h5美食制作网站模板安卓优化大师清理
  • 网站页面高度如何搭建自己的网站
  • 深圳地铁建设集团网站360搜索指数
  • 网站独立服务器怎么制作百度问答app下载
  • 更合公司网站建设西安网站seo技术厂家
  • 17zwd一起做业网站网络营销的优化和推广方式
  • 灵璧哪有做网站的网络营销概念
  • 网站建设哪家强美食软文300范例
  • 建设执业资格注册管理中心网站百度秒收录技术
  • 网站建立分站网站seo外链
  • 有没有网站是免费做店招图片的百度百度一下你就知道主页