本文整理汇总了C++中NodeValue::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeValue::getType方法的具体用法?C++ NodeValue::getType怎么用?C++ NodeValue::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeValue
的用法示例。
在下文中一共展示了NodeValue::getType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: verifyPool
static void verifyPool(NodeValue src, NodeValue dest, size_t kernel,
size_t stride, size_t pad) {
ShapeNHWC idim = ShapeNHWC(src.getType()->dims());
ShapeNHWC odim = ShapeNHWC(dest.getType()->dims());
(void)odim;
assert(idim.w >= kernel && idim.h >= kernel &&
"buffer too small for selected stride");
auto outSz = calculateConvOutputDims(idim.h, idim.w, kernel, stride, pad);
ShapeNHWC exp(idim.n, outSz.first, outSz.second, idim.c);
(void)exp;
assert(exp == odim && "Unexpected output dimensions");
}
示例3: 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");
}
示例4: setOperand
void NodeUse::setOperand(NodeValue &other) {
if (other && site_->getNode()) {
assert(site_->getType() == other.getType() &&
"Setting operand to a node with a different type");
}
site_->setOperand(other.getNode(), other.getResNo());
}
示例5: replaceAllUsesOfWith
void NodeValue::replaceAllUsesOfWith(NodeValue v) {
if (v.getNode()) {
assert(getType() == v.getType() && "Replacing value with the wrong type");
}
auto &users = node_->getUsers();
llvm::SmallVector<NodeUse, 4> usersVec(users.begin(), users.end());
for (auto &U : usersVec) {
NodeValue *site = U.get();
assert(site->getNode() == node_ && "Invalid user");
if (site->getResNo() == getResNo()) {
site->setOperand(v.getNode(), v.getResNo());
}
}
}
示例6: checkSameType
/// Check that the type of the first operand matches the type of the second
/// operand.
static void checkSameType(NodeValue A, NodeValue B) {
assert(A.getType() == B.getType() && "Invalid type");
}