Comments (4)
thanks for the report @ZJUGuoShuai. we recently moved most reductions to cub, so I will check for a regression
from matx.
BTW, it works great with 1D and 2D tensors :)
from matx.
Hi @ZJUGuoShuai, it looks like the order isn't quite what we expect, and we should have errored. The way our reductions work is the output tensor must have the same inner ranks as the input tensor. In other words,
{2,3,2} -> {2} // valid
{2,3,2} -> {6} // not valid
By going from a rank 3 to a rank one you are asking it to sum over the outer 2 dimensions, and the final output would have two values that are the sum of the two 3x2 matrices:
auto mat = vec.View({2, 3, 2});
auto mat_sum = matx::make_tensor<float, 1>({2});
matx::sum(mat_sum, mat);
000000: 21.0000
000001: 57.0000
It looks like instead you want to just sum over 6 rows of 2 columns each, which would be:
auto vec = matx::make_tensor<float, 1>({12});
vec.SetVals({1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12});
auto mat = vec.View({6,2});
auto mat_sum = matx::make_tensor<float, 1>({6});
matx::sum(mat_sum, mat);
mat_sum.Print();
000000: 3.0000
000001: 7.0000
000002: 11.0000
000003: 15.0000
000004: 19.0000
000005: 23.0000
I also had to make a small change since we did have a regression when using CUB for row-wise reductions, so that's back to take a slower path for now and will be fixed next week. You should be able to get the correct answer now with the latest code and the example above.
from matx.
@cliffburdick Thanks, now I know how to use Reduce operations:
the output tensor must have the same inner ranks as the input tensor
from matx.
Related Issues (20)
- [BUG] `clone(slice(diag(A)))` failed HOT 1
- [BUG] Simple einsum program failed to compile HOT 4
- [FEA] Add a `find_peaks` function
- [BUG] Compilation error with MATX_ENABLE_CUTLASS in transforms/matmul.h HOT 3
- [BUG]: #define print replaces print functions in other libraries HOT 3
- [BUG] Clang cannot compile as a host compiler
- [BUG] Conversion issue with matxBf16 and logical > with float literal HOT 1
- [BUG] Configuration error using Ninja Multi-Config. HOT 1
- [BUG] Incorrect configuration using toolchain file.
- [FEA] Improve speed of python to MatX conversions
- [FEA] Add toeplitz operator
- [FEA] Add a generic `solve` function for solving `Ax = b`
- [BUG] argmax returns invalid indices
- [BUG] Error when building MatX on Linux. HOT 35
- [QST] How to get the underlying array of a tensor? HOT 1
- [QST] Somewhat cryptic error message when finding tensor norm. HOT 3
- [FEA] Convert `any`/`all` to use thrust's `any_of` and `all_of`
- [FEA] Indexing one tensor with another tensor HOT 12
- [QST] Subtracting one tensor from another with different shape HOT 6
- [FEA] Better error messages with incompatible matrix sizes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from matx.