当前位置:网站首页>Pytorch框架学习记录10——线性层
Pytorch框架学习记录10——线性层
2022-08-01 20:36:00 【柚子Roo】
Pytorch框架学习记录10——线性层
torch.nn.Linear
(in_features, out_features, bias=True, device=None, dtype=None)
参数:
- in_features – 每个输入样本的大小
- out_features – 每个输出样本的大小
- bias——如果设置为
False
,该层将不会学习附加偏差。默认:True
import torch
from torch import nn
input = torch.tensor([[1, 2, 3],
[1, 0, 3],
[3, 5, 2]], dtype=torch.float32)
input = torch.flatten(input)
class Test(nn.Module):
def __init__(self):
super(Test, self).__init__()
self.fc = nn.Linear(in_features=9, out_features=3)
def forward(self, input):
output = self.fc(input)
return output
test = Test()
output = test(input)
print(output)
边栏推荐
猜你喜欢
专利检索常用的网站有哪些?
小数据如何学习?吉大最新《小数据学习》综述,26页pdf涵盖269页文献阐述小数据学习理论、方法与应用
SIPp 安装及使用
Little data on how to learn?Jida latest small learning data review, 26 PDF page covers the 269 - page document small data learning theory, method and application are expounded
【多任务优化】DWA、DTP、Gradnorm(CVPR 2019、ECCV 2018、 ICML 2018)
98. Embedded controller EC actual combat EC development board development completed
【节能学院】安科瑞餐饮油烟监测云平台助力大气污染攻坚战
基于FPGA的任意字节数(单字节、多字节)的串口(UART)发送(含源码工程)
外骨骼机器人(七):标准步态数据库
Application of Acrel-5010 online monitoring system for key energy consumption unit energy consumption in Hunan Sanli Group
随机推荐
Hangao data import
算法---解码方法(Kotlin)
StringTable详解 串池 性能调优 字符串拼接
解除360对默认浏览器的检测与修改
Debug一个ECC的ODP数据源
互联网大厂研发流程
【无标题】
Different operating with different locks, rounding
【节能学院】推进农业水价综合改革的意见解读
[Energy Conservation Institute] Application of Intelligent Control Device in High Voltage Switchgear
模板特例化和常用用法
有用的网站
OSG笔记:设置DO_NOT_COMPUTE_NEAR_FAR,手动计算远近平面
The Internet giant development process
system collection
【Untitled】
用户身份标识与账号体系实践
4.1 配置Mysql与注册登录模块
string
任务调度线程池-应用定时任务