CAddTable function definitions in the pytorch package

Hi All,

In the CAddTable.py when self.output.add_(input[i]) is executed , I was wondering how to find the C++ functions where the add() operation is defined

Thanks in advance,
Kiran

Hey,

All the C++ / CUDA implementations are present in ATen, and can be found in https://github.com/pytorch/pytorch/tree/master/aten
For your questions in particular, cadd can be seen in here for CUDA, and here for the CPU implementation.

But many operations are moving straight to ATen, which gives more flexibility and nicer interfaces, see for example advanced indexing in ATen

@fmassa thank you so much for the reply and the references. So if we do inputTensor1 + inputTensor2 , the above C++ / CUDA implementations are called ,am I correct? Also I did a simple experiment. To make sure the function is called , a print command was included in the function and I ran the below code
import torch
import torch.legacy.nn as nn
x = torch.Tensor(2,2)
x.fill_(4.0)
y = torch.Tensor(2,2)
y.fill_(3.0)
out = nn.CAddTable().forward([x,y]) ( I know this command is obsolete now in pytorch 0.4)
and it didn’t print anything. Hence I was wondering if there are any other implementations for add function
I will recheck if I have made any mistake.