mshadow icon indicating copy to clipboard operation
mshadow copied to clipboard

how to reduce a one-dimension tensor (vector) ?

Open buaasun opened this issue 7 years ago • 1 comments

I know there are functions for reduce a multi-dimension tensor: reduce_with_axis, reduce_except_dim... but I can't any for one-dimension tensor?

for example: I want to get the sum of a vector, I need function like below

Tensor<cpu,1,int> vec={1,2,3};
int s=reduce<red::sum>(vec);
// s should be 6

How do I achieve this in mshadow?

buaasun avatar Aug 04 '17 09:08 buaasun

This code base has been donated to the Apache MXNet project per #373, and repo is deprecated. Future development and issue tracking should continue in Apache MXNet.

szha avatar Aug 04 '19 00:08 szha