python - 如何在 pytorch 中连接模型?
问题描述
我做了2节课:
class Preprocess():
def __init
.....
def forward
....
class Model ():
def __init
.....
def forward
我想在将它们放入模型之前进行预处理。你能告诉我我怎样才能做到这一点吗?
解决方案
只需编写它们:
pre = Preprocess()
model = Model()
output = model(pre(input))
推荐阅读
- java - Spring MVC 形式的两个模型
- java - JacksonJaxbJsonProvider 在我的实体中忽略@JsonFormat
- css - 为什么在 Sublime 中 justify-items 和 justify-self 语法无效?
- javascript - 递归函数不会进入return语句
- c++ - ftruncate64 成功的 gpfs 上的文件大小不正确
- c# - .net 到 Oracle 日期格式问题
- c# - 低分辨率下的 Unity 模糊
- php - 需要自定义 WordPress 表单来发送电子邮件正文中的所有字段
- c# - 获取任何 AAD 用户的令牌
- sql-server - IBM DB2 到 SQL Server