Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matrix broadcasting not working for 1x1 ∘ 1xn / nx1 matrices #803

Open
Garic152 opened this issue Aug 7, 2024 · 2 comments
Open

Matrix broadcasting not working for 1x1 ∘ 1xn / nx1 matrices #803

Garic152 opened this issue Aug 7, 2024 · 2 comments
Labels
bug A mistake in the code.
Milestone

Comments

@Garic152
Copy link
Contributor

Garic152 commented Aug 7, 2024

Description:

When using the broadcast functionality with a 1x1 matrix and an arbitrary 1xn or nx1 matrix, we don't get a broadcasted matrix as a result but a 1x1 matrix which is the operation applied just to the first elements in the matrices.

Example:

  1. Using the broadcast functionality with two matrices:
    X = [1];
    Y = [1, 2, 3](1,);
    print(X + Y);
    Output:
    DenseMatrix(1x1, int64_t)
    2
    
    Expected Output:
    DenseMatrix(1x3, int64_t)
    2 3 4
    
@Garic152 Garic152 changed the title Matrix broadcasting not working for 1x1 ∘ 1xn/nx1 matrices Matrix broadcasting not working for 1 x 1 ∘ 1 x n / n x 1 matrices Aug 7, 2024
@Garic152 Garic152 changed the title Matrix broadcasting not working for 1 x 1 ∘ 1 x n / n x 1 matrices Matrix broadcasting not working for 1x1 ∘ 1xn / nx1 matrices Aug 7, 2024
@corepointer
Copy link
Collaborator

I recently came across the CUDA version of this problem. We just did not consider a 1x1 matrix as this is supposed to be a case for the EwBinaryObjSca kernel. Maybe a cast of that 1x1 to scalar is a quick fix for now?

@corepointer corepointer added the bug A mistake in the code. label Aug 7, 2024
@corepointer corepointer added this to the v0.3 milestone Aug 7, 2024
@corepointer
Copy link
Collaborator

Looking at the source code again it seems that we only support having the broadcast input on the right of the binary operation (see src/ir/daphneir/DaphneInferShapeOpInterface.cpp:710). Not changing this behavior for 0.3 anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A mistake in the code.
Projects
None yet
Development

No branches or pull requests

2 participants