Comments (5)
Test case for the second semantics:
diff --git a/test/expr_storage-tests.cpp b/test/expr_storage-tests.cpp
index d7be97b..f164fac 100644
--- a/test/expr_storage-tests.cpp
+++ b/test/expr_storage-tests.cpp
@@ -185,6 +185,18 @@ INSTANTIATE_TEST_CASE_P(vector_scalar, expr,
}
},
{2.0, 4.0, 2.0, 2.0, 5.0}
+ ),
+ TestData(Tensor<double>("a",{5},Format({Sparse})),
+ {i},
+ d5a("b",Format({Sparse}))(i) + da("c",Format())(),
+ {
+ {
+ // Sparse index
+ {0,4},
+ {0,1,2,3,4}
+ }
+ },
+ {2.0, 4.0, 2.0, 2.0, 5.0}
)
)
);
from taco.
This is how NumPy does it: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html.
Matlab's latest release seems to have also adopted broadcasting: https://nickhigham.wordpress.com/2016/09/20/implicit-expansion-matlab-r2016b/
from taco.
If we adopt the first semantics, then would that not imply that the result of the computation can change depending on which storage format is used to store b
, even if b
is unchanged mathematically? That doesn't seem very intuitive or reasonable in my opinion.
from taco.
@stephenchouca that is a very good point and I think sufficient to adopt the second semantics.
@shoaibkamil The NumPy/Matlab documents don't seem to consider what happens if you're broadcasting over a sparse dimension, but it seems it is most natural broadcasting is over a dimension (semantics 2) and not over non-zero values (semantics 1). #6 also discusses broadcast semantics.
It seems like we all think the semantics 2 is correct.
from taco.
We should also support explicitly multiplying by a scalar/variable:
a(i) = 0.25 * b(i)
from taco.
Related Issues (20)
- pytaco.tensor_sum() gives a wrong answer
- Reshape HOT 1
- Complex number realization for the python interface HOT 1
- tests fail on macOS ppc/ppc64; on 10.6.8 x86_64 two tests fail HOT 15
- Is it possible to generate OpenCL kernels with TACO? HOT 6
- Memory leak with `pytaco`
- Failure due to CUDA errors when generating code for CPU?
- Online tool cannot connect to server
- convolution HOT 2
- Scheduling Language more information. HOT 1
- Building Taco failed HOT 1
- Using IndexSetVar defined at runtime
- Output transformed C++ kernel code from the TACO C++ source code HOT 1
- Incorrect code generated when contraction index is not innermost
- kernel seg fault when processing large tensors HOT 1
- Double Occurrence of Parameters in Kernels Generated with CLI tool.
- COO sparse tensor contraction produces missing & duplicated entries
- TACO does not run parallel HOT 1
- BLD: building in modern Python environments HOT 1
- Can not generate omp parallel code for sparse tensors 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 taco.