Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf095c05

Browse files
committed
Supporting scalar tensor broadcasting
1 parentb5c1702 commitf095c05

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

‎MathOps.hpp‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,11 @@ void Add(S_TENSOR input, S_TENSOR input2, S_TENSOR out) {
278278
TOut* p_out = out->write<TOut>(0,0);
279279

280280
constuint32_t size = out->getSize();
281+
// [FIXME] hacking for broadcasting scalar tensor
282+
constuint32_t size1 = input->getSize();
283+
constuint32_t size2 = input2->getSize();
281284
for (uint32_t i =0; i < size; i++) {
282-
p_out[i] = p_in[i] + p_in2[i];
285+
p_out[i] = p_in[size1 >1 ? i :0] + p_in2[size2 >1 ? i :0];
283286
}
284287
}
285288

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp