const size_t row_bytes = values_info->total_size() / row_size;
for (size_t i = 0; i < lookups_info->dimension(0); ++i)
{
- size_t idx = lookups_buf[i];
- if (idx >= row_size || idx < 0)
+ if (lookups_buf[i] < 0 || lookups_buf[i] >= row_size)
throw std::runtime_error("Embedding Lookup: index out of bounds.");
+ size_t idx = lookups_buf[i];
size_t row_offset_by_idx = values_info->offset_element_in_bytes({0, idx});
size_t row_offset_by_i = output_info->offset_element_in_bytes({0, i});
const size_t row_bytes = values_info->total_size() / row_size;
for (size_t i = 0; i < lookups_info->dimension(0); ++i)
{
- size_t idx = lookups_buf[i];
- if (idx >= row_size || idx < 0)
+ if (lookups_buf[i] < 0 || lookups_buf[i] >= row_size)
throw std::runtime_error("Embedding Lookup: index out of bounds.");
+ size_t idx = lookups_buf[i];
size_t row_offset_by_idx = values_info->offset_element_in_bytes({0, 0, idx});
size_t row_offset_by_i = output_info->offset_element_in_bytes({0, 0, i});
const size_t row_bytes = values_info->total_size() / row_size;
for (size_t i = 0; i < lookups_info->dimension(0); ++i)
{
- size_t idx = lookups_buf[i];
- if (idx >= row_size || idx < 0)
+ if (lookups_buf[i] < 0 || lookups_buf[i] >= row_size)
throw std::runtime_error("Embedding Lookup: index out of bounds.");
+ size_t idx = lookups_buf[i];
size_t row_offset_by_idx = values_info->offset_element_in_bytes({0, 0, 0, idx});
size_t row_offset_by_i = output_info->offset_element_in_bytes({0, 0, 0, i});