Difference between '+' and add

I’m using python3.5 + pytorch0.3.0. I want to know the difference between equation (1) and (2).
(1) a = b + c
(2) a = torch.add(b, c)
(b, c are all tensor)
similarly: a = b / c and a = torch.div(b, c)

2 Likes

@smth Can you help me? Thanks a lot

(1) and (2) are equivalent

a = b / c and a = torch.div(b, c) are also equivalent. Here’s how it is hooked up in the source code: https://github.com/pytorch/pytorch/blob/master/tools/autograd/templates/python_variable_methods.cpp#L640

4 Likes

OK, Thanks for your reply.