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


C++ NodeValue类代码示例

本文整理汇总了C++中NodeValue的典型用法代码示例。如果您正苦于以下问题:C++ NodeValue类的具体用法?C++ NodeValue怎么用?C++ NodeValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了NodeValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: printAllValuesForNode

/// printAllValuesForNode -- prints all values for a given node, without a newline
/// (meant to be a helper)
static void printAllValuesForNode(llvm::raw_ostream &O, NodeValue &NV) {
  // We only consider other values that are in the graph
  // containing the specified node (by design)

  // Look for values that have an equivalent NH
  DSNodeHandle &NH = NV.getNodeH();
  const DSGraph::ScalarMapTy &SM = NV.getGraph()->getScalarMap();
  bool first = true;

  for (DSGraph::ScalarMapTy::const_iterator I = SM.begin(), E = SM.end();
      I != E; ++I )
    if (NH == I->second) {
      //Found one!
      const Value *V = I->first;

      //Print them out, separated by commas
      if (!first) O << ",";
      first = false;

      // Print out name, if it has one.
      // FIXME: Get "%0, "%1", naming like the .ll has?
      if (V->hasName())
        O << V->getName();
      else
        O << "<tmp>";
    }

  //FIXME: Search globals in this graph too (not just scalarMap)?
}
开发者ID:Checkmate50,项目名称:smack,代码行数:31,代码来源:DSTest.cpp

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

示例3: NewNode

//----------------------------------------------------------------------------------------------
void GraphScene::NewNode()
{
    if(m_pChoosePlanStepDlg->exec() == QDialog::Accepted)
    {
        unsigned planStepId = m_pChoosePlanStepDlg->SelectedPlanStepId();
        NodeValue pNodeModel = NULL;

        if(BELONG(GoalType, planStepId))
            pNodeModel = g_GoalFactory.GetGoal((GoalType)planStepId, false);
        else if(BELONG(ActionType, planStepId))
            pNodeModel = g_ActionFactory.GetAction((ActionType)planStepId, false);
        else
            throw NotImplementedException(XcptHere);

        _ASSERTE(planStepId != NULL);

        NodeID nodeId = m_pGraph->AddNode(pNodeModel, pNodeModel->Id());

        GraphNodeView *pNodeView = new GraphNodeView(pNodeModel, nodeId, m_pPlanContext, m_pNodeMenu, nullptr);

        pNodeView->setPos(m_lastCtxtMenuScreenPos.x(), m_lastCtxtMenuScreenPos.y());

        m_nodeIdToNodeViewMap[nodeId] = pNodeView;

        addItem(pNodeView);
    }
}
开发者ID:mabdelmonemali,项目名称:IStrategizer,代码行数:28,代码来源:GraphScene.cpp

示例4: printNode

/// printNodes -- print the node specified by NV
///
/// Format:
/// "flags:{value(s)}:{type(s)}"
///
/// Additionally, the user can specify to print just one piece
static void printNode(llvm::raw_ostream &O, NodeValue &NV) {
  assert(
      ((!OnlyPrintFlags && !OnlyPrintValues)||
      (!OnlyPrintFlags && !OnlyPrintTypes) ||
      (!OnlyPrintValues && !OnlyPrintTypes)) &&
      "Only one \"Only\" option allowed!");

  if (OnlyPrintFlags) {
    printFlags(O,NV.getNode());
  } else if (OnlyPrintValues) {
    printAllValuesForNode(O, NV);
  } else if (OnlyPrintTypes) {
    printTypesForNode(O, NV);
  } else {
    //Print all of them
    printFlags(O,NV.getNode());
    O << ":{";
    printAllValuesForNode(O, NV);
    O << "}:{";
    printTypesForNode(O, NV);
    O << "}";
  }

  O << "\n";
}
开发者ID:Checkmate50,项目名称:smack,代码行数:31,代码来源:DSTest.cpp

示例5: count

bool UnownedNodeValueMap::count(NodeValue from) {
  for (auto &E : entries_) {
    auto &F = E.first;
    if (F.first == from.getNode() && F.second == from.getResNo()) {
      return true;
    }
  }

  return false;
}
开发者ID:,项目名称:,代码行数:10,代码来源:

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

示例7: typesUsed

IlwisTypes OperationNodeScript::typesUsed(int index, const NodeValue& vright, SymbolTable &symbols) const {
    if ( index >= vright.size())
        return itUNKNOWN;

    IlwisTypes tp1 = symbols.ilwisType(vright[index], vright.id(index));
    IlwisTypes tp2 = symbols.ilwisType(_value[index], _value.id(index));

    if ( tp1 == itUNKNOWN || tp2 == itUNKNOWN)
        return itUNKNOWN;
    return tp1 | tp2;

}
开发者ID:52North,项目名称:IlwisCore,代码行数:12,代码来源:operationnodescript.cpp

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

示例9: NodeValue

NodeValue UnownedNodeValueMap::get(NodeValue from) {
  for (auto &E : entries_) {
    auto &F = E.first;
    auto &T = E.second;

    if (F.first == from.getNode() && F.second == from.getResNo()) {
      return NodeValue(T.first, T.second);
    }
  }

  llvm_unreachable("Invalid node");
  return NodeValue(nullptr, 0);
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例10: 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,代码来源:

示例11: printTypesForNode

// printTypesForNode --prints all the types for the given NodeValue, without a newline
// (meant to be called as a helper)
static void printTypesForNode(llvm::raw_ostream &O, NodeValue &NV) {
  DSNode *N = NV.getNode();

  if (N->isNodeCompletelyFolded()) {
    O << "Folded";
  }
  // Go through all the types, and just dump them.
  // FIXME: Lifted from Printer.cpp, probably should be shared
  bool firstType = true;
  if (N->type_begin() != N->type_end())
    for (DSNode::TyMapTy::const_iterator ii = N->type_begin(),
        ee = N->type_end(); ii != ee; ++ii) {
      if (!firstType) O << "::";
      firstType = false;
      O << ii->first << ":";
      if (ii->second) {
        bool first = true;
        for (svset<Type*>::const_iterator ni = ii->second->begin(),
            ne = ii->second->end(); ni != ne; ++ni) {
          if (!first) O << "|";
          Type * t = *ni;
          t->print (O);
          first = false;
        }
      }
      else
        O << "VOID";
    }
  else
    O << "VOID";

  if (N->isArrayNode())
    O << "Array";
}
开发者ID:Checkmate50,项目名称:smack,代码行数:36,代码来源:DSTest.cpp

示例12: getName

QString TermNode::getName(const NodeValue& var) const {
    QString name = var.toString();
    if (name != sUNDEF)
        return name;
//    QString typeName = var.typeName();
//    if ( typeName == "Ilwis::IRasterCoverage") {
//        Ilwis::IRasterCoverage raster = var.value<Ilwis::IRasterCoverage>();
//        name = raster->name();
//    }
//    if ( typeName == "Coordinate") {
//        name = var.id();
//    }
//    if ( typeName == "Voxel") {
//        name = var.id();
//    }
    return var.id();
}
开发者ID:ridoo,项目名称:IlwisCore,代码行数:17,代码来源:termnode.cpp

示例13: 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,代码来源:

示例14: QString

bool OperationNodeScript::handleTableCases(int index, const NodeValue& vright, const QString &operation,
                                              const QString& relation, SymbolTable &symbols, ExecutionContext *ctx) {
    if ( index >= vright.size())
        return false;

    QString expr;
    if ( SymbolTable::isNumerical(vright[index]) && SymbolTable::isDataLink(_value[index])){
        expr = QString("%1(%2,%3,%4,%5)").arg(operation).arg(_value.toString(index)).
                                          arg(additionalInfo(ctx,_value.toString(index))).
                                          arg(vright.toDouble(index)).arg(relation);
    } else if (SymbolTable::isNumerical(_value[index]) && SymbolTable::isDataLink(vright[index])){
        expr = QString("%1(%2,%3,%4, %5)").arg(operation).arg(vright.toString(index)).
                                           arg(additionalInfo(ctx,vright.toString(index))).
                                           arg(_value.toDouble(index)).arg(relation);
    } else if (SymbolTable::isDataLink(_value[index]) && SymbolTable::isDataLink(vright[index])) {
        expr = QString("%1(%2,%3,%4,%5)").arg(operation).arg(vright.toString(index)).arg(_value.toString(index)).arg(relation);
    } else if (SymbolTable::isDataLink(vright[index]) && SymbolTable::isNumerical(_value[index])) {
        expr = QString("%1(%2,%3,%4,%5)").arg(operation).arg(vright.toString(index)).arg(_value.toDouble(index)).arg(relation);
    }

    bool ok = Ilwis::commandhandler()->execute(expr, ctx,symbols);
    if ( !ok || ctx->_results.size() != 1)
        return false;
    _value = {ctx->_results[0], NodeValue::ctID};
    return true;
}
开发者ID:52North,项目名称:IlwisCore,代码行数:26,代码来源:operationnodescript.cpp

示例15: assert

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


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