How bcast works
#6190
-
I saw a testcase in test-backend-ops to test bcast with ADD, MUL and DIV. As far as I know, bcast only works for different dims, and all dims should be same or 1. But this case cast is adding tensor a(16,10,10,10) with b(32,10,10,10). I read the source code, but can't undersand clearly, could some one tell me how it works? Does it bcast tensor a(16,10,10,10) to (32,10,10,10), and copy first "0-16" to "17-31"? |
Beta Was this translation helpful? Give feedback.
Answered by
slaren
Mar 21, 2024
Replies: 1 comment
-
It repeats the second tensor to match the dimension of the first. Eg. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
hipudding
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It repeats the second tensor to match the dimension of the first. Eg.
ggml_add(a, b)
is equivalent toggml_add(a, ggml_repeat(b, a))
.