本文整理汇总了C++中NodeValue::dims方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeValue::dims方法的具体用法?C++ NodeValue::dims怎么用?C++ NodeValue::dims使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeValue
的用法示例。
在下文中一共展示了NodeValue::dims方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: verifyFullyConnected
static void verifyFullyConnected(NodeValue src, NodeValue weights,
NodeValue bias, NodeValue dest) {
assert(src.dims()[0] == dest.dims()[0] &&
flattenCdr(src.dims()).second == weights.dims()[0] &&
"Mismatch on expected source dimensions");
assert(bias.dims()[0] == weights.dims()[1] &&
weights.dims()[1] == dest.dims()[1] &&
"Inconsistent bias/weights/dest sizes.");
}
示例2: verifyBatchNormalization
static void verifyBatchNormalization(NodeValue src, NodeValue dest,
NodeValue bias, NodeValue scale,
NodeValue mean, NodeValue var,
size_t channel) {
checkSameType(dest, src);
// Figure out how many channels are in the tensor.
size_t channels = src.dims()[channel];
auto exp = {channels};
(void)exp;
assert(bias.getType()->dims().equals(exp) && "Invalid bias dim");
assert(scale.getType()->dims().equals(exp) && "Invalid scale dim");
assert(mean.getType()->dims().equals(exp) && "Invalid mean dim");
assert(var.getType()->dims().equals(exp) && "Invalid var dim");
}
示例3: verifyCrossEntropyLoss
static void verifyCrossEntropyLoss(NodeValue P, NodeValue CE,
NodeValue labels) {
assert(P.getElementType() == CE->getElementType());
assert(P.dims()[0] == labels.dims()[0] && "Invalid shape");
}
示例4: verifySoftMax
static void verifySoftMax(NodeValue src, NodeValue dest) {
checkSameType(src, dest);
assert(src.dims() == dest.dims() && "Invalid shape");
}
示例5: checkSameShape
/// Check that the shape of the first operand matches the shape of the second
/// operand.
static void checkSameShape(NodeValue A, NodeValue B) {
assert(A.dims() == B.dims() && "Invalid shape");
}