当前位置: 首页>>代码示例>>C++>>正文


C++ NodeValue::dims方法代码示例

本文整理汇总了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.");
}
开发者ID:,项目名称:,代码行数:10,代码来源:

示例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");
}
开发者ID:,项目名称:,代码行数:16,代码来源:

示例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");
}
开发者ID:,项目名称:,代码行数:5,代码来源:

示例4: verifySoftMax

static void verifySoftMax(NodeValue src, NodeValue dest) {
  checkSameType(src, dest);
  assert(src.dims() == dest.dims() && "Invalid shape");
}
开发者ID:,项目名称:,代码行数:4,代码来源:

示例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");
}
开发者ID:,项目名称:,代码行数:5,代码来源:


注:本文中的NodeValue::dims方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。