| 11 | namespace { |
| 12 | |
| 13 | int64_t checked_product(std::initializer_list<int64_t> dims) { |
| 14 | int64_t result = 1; |
| 15 | for (const int64_t dim : dims) { |
| 16 | result *= dim; |
| 17 | } |
| 18 | return result; |
| 19 | } |
| 20 | |
| 21 | float stable_softmax_pick(const float * row, int64_t vocab_size, float uniform) { |
| 22 | float max_value = row[0]; |