首页 > 其他 > 详细

Pytorch-Is it possible to forward a tensor through a model (only Variable works)?

时间:2018-06-30 10:22:06      阅读:242      评论:0      收藏:0      [点我收藏+]

In Pytorch 0.4, I can forward a tensor through a model which is the same as Variable.

import torch
print(torch.__version__)

 

Maybe in Pytorch version < 0.4, it is not possible to forward a tensor through am model.

 

Ref to:

https://discuss.pytorch.org/t/what-is-the-difference-between-tensors-and-variables-in-pytorch/4914/3

 

The Variable class is a wrapper over torch Tensors (nd arrays in torch) that supports nearly all operations defined on tensors. PyTorch requires that the input tensor to be forward propagated has to be wrapped in a Variable. This facilitates automatic back propagation by simply calling the method backward() in the Variable class.

 

技术分享图片

 

Pytorch-Is it possible to forward a tensor through a model (only Variable works)?

原文:https://www.cnblogs.com/quinn-yann/p/9245978.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!