xingyizhou / pytorch-pose-hg-3d

PyTorch implementation for 3D human pose estimation
GNU General Public License v3.0
613 stars 143 forks source link

Why self define FusionCriterion function? #30

Closed FightForCS closed 5 years ago

FightForCS commented 6 years ago

Hi, thanks for your great work. May I ask why do you write FusionCriterion function with forward pass and backward pass on your own? As far as I know, the forward pass is already differentiable, Pytorch itself can handle the backward pass, right? Is there something important that I was missing? In this link https://discuss.pytorch.org/t/how-to-use-condition-flow/644/3 , using Variable.data is still a safe operation in building a graph. Looking for your reply, Thanks.

xingyizhou commented 6 years ago

Hi FightForCS, This is a really good question! Actually I don't know using Variable.data can be directly used to build the graph (and I still doubt that, especially when the code involves some counting by visibility operation). For me, I just directly translate my luaTorch code (https://github.com/xingyizhou/pose-hg-3d/blob/master/src/models/layers/VarCriterion.lua#L56) to python.