Fix a few issues: docs for flatten, erf, dequantize validation (#560)

* doc flatten

* erf doc

* check values for dequantize

* format
This commit is contained in:
Awni Hannun
2024-01-26 15:16:46 -08:00
committed by GitHub
parent bf17ab5002
commit 07f35c9d8a
2 changed files with 24 additions and 1 deletions

View File

@@ -2993,6 +2993,16 @@ array dequantize(
int group_size /* = 64 */,
int bits /* = 4 */,
StreamOrDevice s /* = {} */) {
if (bits <= 0) {
std::ostringstream msg;
msg << "[dequantize] Invalid value for bits: " << bits;
throw std::invalid_argument(msg.str());
}
if (group_size <= 0) {
std::ostringstream msg;
msg << "[dequantize] Invalid value for group_size: " << group_size;
throw std::invalid_argument(msg.str());
}
if (w.ndim() != 2 || scales.ndim() != 2 || biases.ndim() != 2) {
throw std::invalid_argument("[dequantize] Only matrices supported for now");
}