Help understanding 1.12 tensorflow code

Dear Community,

Could you please give me some guidance on what’s going on in the linked code? https://github.com/haebeom-lee/l2b/blob/master/model.py

I’m making a PyTorch version and, I’m trying to troubleshoot by seeing what the outputs at each step of the model are. I’m really confused because, the model’s forward_outer_multiple, which is being called in the main.py, doesn’t take input as the argument? (It seems that earlier in the code, empty tf.placeholder tensors are created, so the model is just calculating these empty tensors and thus doing nothing??)

I know in PyTorch, the forward() method of models take the data input directly, so I can see what’s coming out of it. I’m completely confused by what’s going on here. I’ve searched up many places but, the tutorials are all about adding layers with the keras tool, which seems completely different from what’s going on in the code!

Thank you so much!

Hi @Gears_Gears,In TensorFlow 1.x, we define the inputs as placeholders or tensors, and construct the layers and operations that connect these placeholders to build the forward pass. so the input data is usually fed into the graph during a session run. This means that the forward pass doesn’t directly take input data as an argument. Similar behavior can be observed in the 2.x version of tensorflow by using the input layer. Thank you.

1 Like