numpy和poytorch构建神经网络的对比

2021-01-14 11:16:30 浏览数 (1)

文章目录

  • numpy 构建network
    • torch 构建nn

numpy 构建network

代码语言:javascript复制
# -*- coding:utf-8 -*-
# /usr/bin/python
'''
-------------------------------------------------
   File Name   :  numpy_nn
   Description :  AIM: numpy nn
                  Functions: 1. 
                             2. 
   Envs        :  python == 
                  pip install  -i https://pypi.douban.com/simple 
   Author      :  errol
   Date        :  2020/5/4  21:57
   CodeStyle   :  规范,简洁,易懂,可阅读,可维护,可移植!
-------------------------------------------------
   Change Activity:
          2020/5/4 : text
-------------------------------------------------
'''

import numpy as np

# N是批量大小; D_in是输入维度;
# 49/5000 H是隐藏的维度; D_out是输出维度。
N, D_in, H, D_out = 64, 1000, 100, 10

# 创建随机输入和输出数据
x = np.random.ran

0 人点赞