Skip to content

Commit d77cb3d

Browse files
Yavuz Yetimfacebook-github-bot
authored andcommitted
Change the TBE bounds check to match the TBE implementation. (#3773)
Summary: X-link: facebookresearch/FBGEMM#853 TBE implementation accepts weights to be zero sized to represent empty weights. Reviewed By: sryap Differential Revision: D70660808
1 parent d162e6e commit d77cb3d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

fbgemm_gpu/codegen/utils/embedding_bounds_check_host_cpu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void bounds_check_indices_cpu(
9696
" is not equal to B (" + std::to_string(B) + ") * T (" +
9797
std::to_string(T) + ") + 1");
9898
}
99-
if (weights.has_value()) {
99+
if (weights.has_value() && weights->numel() != 0) {
100100
TORCH_CHECK(
101101
weights.value().size(0) == num_indices,
102102
"weights size " + std::to_string(weights.value().size(0)) +

fbgemm_gpu/codegen/utils/embedding_bounds_check_v1.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ void _bounds_check_indices_cuda_v1(
227227
" is not equal to B (" + std::to_string(B) + ") * T (" +
228228
std::to_string(T) + ") + 1");
229229
}
230-
if (weights.has_value()) {
230+
if (weights.has_value() && weights->numel() != 0) {
231231
TORCH_CHECK(
232232
weights.value().size(0) == num_indices,
233233
"weights size " + std::to_string(weights.value().size(0)) +

0 commit comments

Comments
 (0)