Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions onnxruntime/contrib_ops/cpu/moe/moe_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,22 @@ struct MoEParameters {
MoEParallelType parallel_type{MoEParallelType::None};
int64_t tensor_shards{1};
};

namespace moe_helper {

// Validate block-wise quantization requirements according to op spec
inline Status ValidateBlockwiseQuantization(int64_t block_size, int64_t hidden_size, int64_t inter_size) {
if (block_size > 0) {
ORT_ENFORCE(hidden_size % block_size == 0,
"For block-wise quantization, hidden_size (", hidden_size,
") must be divisible by block_size (", block_size, ").");
ORT_ENFORCE(inter_size % block_size == 0,
"For block-wise quantization, inter_size (", inter_size,
") must be divisible by block_size (", block_size, ").");
}
return Status::OK();
}

template <typename Tensor>
Status CheckInputs(MoEParameters& parameters,
const Tensor* input, // required
Expand Down
Loading
Loading