首页 > 其他 > 详细

搭建神经网络

时间:2019-12-29 22:25:57      阅读:84      评论:0      收藏:0      [点我收藏+]

PyTorch是使用GPU和CPU优化的深度学习张量库。这篇博客记录如何使用pyTorch初步搭建神经网络。

一、搭建神经网络

1.1 基本概念

  • 基于pyTorch的NN:用张量表示数据,用计算图搭建神经网络,用会话执
    行计算图,优化线上的权重(参数),得到模型。

  • 张量:张量就是多维数组(列表),用“阶”表示张量的维度。

  • 数据类型

    python pytorch
    Int IntTensor of size()
    float FloatTensor of size()
    Int array IntTensor of size [d1,d2,…]
    Float array FloatTensor of size [d1,d2,…]
    string ont-hot or Embedding(Word2Vec,glove)

    pyTorch内建的数据类型

Data tyoe dtype CPU tensor GPU tensor
32-bit floating point torch.float32 or torch.float torch.FloatTensor torch.cuda.FloatTensor
64-bit floating point torch.float64 or torch.double torch.DoubleTensor torch.cuda.DoubleTensor
16-bit floating point torch.float16 or torch.half N/A torch.cuda.HalfTensor
8-bit integer (unsigned) torch.uint8 torch.ByteTensor torch.cuda.ByteTensor
8-bit integer (signed) torch.int8 torch.CharTensor torch.cuda.CharTensor
16-bit integer (signed) torch.int16 or torch.short torch.ShortTensor torch.cuda.ShortTensor
32-bit integer (signed) torch.int32 or torch.int torch.IntTensor torch.cuda.IntTensor
64-bit integer (signed) torch.int64 or torch.long torch.LongTensor torch.cuda.LongTensor

搭建神经网络

原文:https://www.cnblogs.com/lyszyl/p/12116710.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!