numpy’s sum() is like tensorflow’s reduce sum. Unfortunately right now pytorch’s sum doesn’t support summing over an axis (it’s being worked on, though! 477) but there are ways to be creative with this.