'Calculates the arithmetic mean of the elements along the specified
axes.
Arguments:
a (Tensor): the Tensor on which to perform the operation
axis (int, optional): the dimension along which to compute.
If set to None, we will take mean over all
dimensions.  Defaults to None
partial (bool, optional): Not currently used.
out (Tensor, optional): where the result will be stored. If out is
None, only the op-tree will be returned.
keepdims (bool, optional): Keep the axes being computed over in the
output (with size 1), instead of
collapsing.  Defaults to True.
Returns:
OpTreeNode: the resulting op-tree'

def mean(self, a, axis=None, partial=None, out=None, keepdims=True):

    shape = a.shape
    if (axis is None):
        return self.multiply(self.sum(a), (1.0 / (shape[0] * shape[1])), out=out)
    return self.multiply(self.sum(a, axis=axis), (1.0 / shape[axis]), out=out)
