Skip to content

Commit

Permalink
Fix MSVC compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumekln committed Sep 7, 2023
1 parent 3687a6c commit 9c2c06d
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/ops/position_encodings_add.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,20 @@ namespace ctranslate2 {

output.resize_as(input);

DEVICE_AND_FLOAT_DISPATCH(
"PositionEncodingsAdd", input.device(), input.dtype(),
({
if (offsets)
compute<D, T>(step, offsets, input, encodings, output);
else
primitives<D>::add_batch_broadcast(encodings.data<T>() + step * depth,
input.data<T>(),
output.data<T>(),
time * depth,
input.size());
}));
if (offsets) {
DEVICE_AND_FLOAT_DISPATCH(
"PositionEncodingsAdd", input.device(), input.dtype(),
(compute<D, T>(step, offsets, input, encodings, output)));

} else {
DEVICE_AND_FLOAT_DISPATCH(
"PositionEncodingsAdd", input.device(), input.dtype(),
(primitives<D>::add_batch_broadcast(encodings.data<T>() + step * depth,
input.data<T>(),
output.data<T>(),
time * depth,
input.size())));
}
}

}
Expand Down

0 comments on commit 9c2c06d

Please sign in to comment.