当前位置:网站首页>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)
边栏推荐
- string
- 数据库单字段存储多个标签(位移操作)
- SIPp 安装及使用
- Interpretation of the meaning of each dimension of two-dimensional, three-dimensional, and four-dimensional matrices
- 1374. 生成每种字符都是奇数个的字符串 : 简单构造模拟题
- 微信小程序云开发|个人博客小程序
- 有点奇怪!访问目的网址,主机能容器却不行
- 我的驾照考试笔记(2)
- New graduate students, great experience in reading English literature, worthy of your collection
- Redis does web page UV statistics
猜你喜欢

Wildcard SSL/TLS certificate

虚拟机的IP地址自动变为127.0.0.1

To promote energy conservation institute 】 【 the opinions of the agricultural water price reform

4.1 配置Mysql与注册登录模块

【Dart】dart构造函数学习记录(含dart单例模式写法)
![[Personal Work] Remember - Serial Logging Tool](/img/8c/56639e234ec3472f4133342eec96d6.png)
[Personal Work] Remember - Serial Logging Tool

【节能学院】智能操控装置在高压开关柜的应用

LTE时域、频域资源

idea插件generateAllSetMethod一键生成set/get方法以及bean对象转换

98. Embedded controller EC actual combat EC development board development completed
随机推荐
1374. 生成每种字符都是奇数个的字符串 : 简单构造模拟题
我的驾照考试笔记(4)
[Energy Conservation Institute] Application of Intelligent Control Device in High Voltage Switchgear
StringTable详解 串池 性能调优 字符串拼接
Determine a binary tree given inorder traversal and another traversal method
微信小程序云开发|个人博客小程序
我的驾照考试笔记(3)
WeChat applet cloud development | personal blog applet
OSG笔记:设置DO_NOT_COMPUTE_NEAR_FAR,手动计算远近平面
线程池处理异常的方法
作为程序员你应该会的软件
用户体验好的Button,在手机上不应该有Hover态
使用微信公众号给指定微信用户发送信息
线上问题排查常用命令,总结太全了,建议收藏!!
Application of Acrel-5010 online monitoring system for key energy consumption unit energy consumption in Hunan Sanli Group
【Untitled】
【多任务模型】Progressive Layered Extraction: A Novel Multi-Task Learning Model for Personalized(RecSys‘20)
Redis does web page UV statistics
面试突击70:什么是粘包和半包?怎么解决?
密码学的基础:X.690和对应的BER CER DER编码