当前位置:网站首页>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)
边栏推荐
猜你喜欢
面试突击70:什么是粘包和半包?怎么解决?
AQS原理和介绍
启明云端分享|盘点ESP8684开发板有哪些功能
98. Embedded controller EC actual combat EC development board development completed
【多任务模型】Progressive Layered Extraction: A Novel Multi-Task Learning Model for Personalized(RecSys‘20)
我的驾照考试笔记(2)
【Untitled】
[Multi-task learning] Modeling Task Relationships in Multi-task Learning with Multi-gate Mixture-of-Experts KDD18
仿牛客论坛项目
研究生新同学,牛人看英文文献的经验,值得你收藏
随机推荐
乐观锁批量跟新 纯SQL
Interpretation of the meaning of each dimension of two-dimensional, three-dimensional, and four-dimensional matrices
作为程序员你应该会的软件
LinkedList源码分享
漏刻有时文档系统之XE培训系统二次开发配置手册
LinkedList source code sharing
Different operating with different locks, rounding
【无标题】
有用的网站
tiup mirror clone
Wildcard SSL/TLS certificate
Goroutine Leaks - The Forgotten Sender
【luogu P1912】诗人小G(二分栈)(决策单调性优化DP)
LTE time domain and frequency domain resources
瀚高数据导入
面试突击70:什么是粘包和半包?怎么解决?
98. Embedded controller EC actual combat EC development board development completed
LTE时域、频域资源
iptables的使用简单测试
latex论文神器--服务器部署overleaf