本文整理汇总了C++中NodeValue::getElementType方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeValue::getElementType方法的具体用法?C++ NodeValue::getElementType怎么用?C++ NodeValue::getElementType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeValue
的用法示例。
在下文中一共展示了NodeValue::getElementType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: verifyConvolution
static void verifyConvolution(NodeValue src, NodeValue dest, NodeValue filter,
NodeValue bias, size_t kernel, size_t stride,
size_t pad, size_t group) {
assert(src.getElementType() == dest.getElementType() && "Invalid Type");
assert(src.getElementType() == filter.getElementType() && "Invalid Type");
assert(src.getElementType() == bias.getElementType() && "Invalid Type");
ShapeNHWC idim(src.getType()->dims());
ShapeNHWC odim(dest.getType()->dims());
assert(idim.w >= kernel && idim.h >= kernel &&
"buffer too small for selected stride");
assert(idim.c % group == 0 && "channels number must be divisible by groups");
auto outSz = calculateConvOutputDims(idim.h, idim.w, kernel, stride, pad);
(void)outSz;
assert(odim.n == idim.n && odim.h == outSz.first && odim.w == outSz.second &&
odim.c % group == 0 && "Invalid output dimensions");
auto filterDims = {odim.c, kernel, kernel, idim.c / group};
assert(filter.getType()->dims().equals(filterDims) && "Invalid filter dims");
(void)filterDims;
auto biasDims = {odim.c};
assert(bias.getType()->dims().equals(biasDims) && "Invalid bias dims");
(void)biasDims;
}
示例2: verifyCrossEntropyLoss
static void verifyCrossEntropyLoss(NodeValue P, NodeValue CE,
NodeValue labels) {
assert(P.getElementType() == CE->getElementType());
assert(P.dims()[0] == labels.dims()[0] && "Invalid shape");
}
示例3: checkType
static void checkType(NodeValue A, ElemKind expectedType) {
assert(A.getElementType() == expectedType && "Invalid type");
}