• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Forward函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: while

Token LexicalAnalysis::GetKeywordOrIdentifier(string& _string)
{
	while (IsAlphaOrUnderline(*m_bufferMoved))
	{
		_string += *m_bufferMoved;
		if (!Forward())
			return ERROR;
	}
	while (IsAlphaOrNumberOrUnderline(*m_bufferMoved))
	{
		_string += *m_bufferMoved;
		if (!Forward())
			return ERROR;
	}
	for (int i = 0; i < m_keywordLen; ++i)
	{
		if (_string == m_keyword[i])
		{
			//the word is a keyword
			return (Token)i;
		}
	}

	//the word is an id
	return ID;
}
开发者ID:NinjaRhyme,项目名称:LexicalAnalysis,代码行数:26,代码来源:LexicalAnalysis.cpp


示例2: ResetParameter

void FFN<
LayerTypes, OutputLayerType, InitializationRuleType, PerformanceFunction
>::Predict(arma::mat& predictors, arma::mat& responses)
{
  deterministic = true;

  arma::mat responsesTemp;
  ResetParameter(network);
  Forward(arma::mat(predictors.colptr(0), predictors.n_rows, 1, false, true),
      network);
  OutputPrediction(responsesTemp, network);

  responses = arma::mat(responsesTemp.n_elem, predictors.n_cols);
  responses.col(0) = responsesTemp.col(0);

  for (size_t i = 1; i < predictors.n_cols; i++)
  {
    Forward(arma::mat(predictors.colptr(i), predictors.n_rows, 1, false, true),
        network);

    responsesTemp = arma::mat(responses.colptr(i), responses.n_rows, 1, false,
        true);
    OutputPrediction(responsesTemp, network);
    responses.col(i) = responsesTemp.col(0);
  }
}
开发者ID:GYengera,项目名称:mlpack,代码行数:26,代码来源:ffn_impl.hpp


示例3: WdeWriteSymInfo

void WdeWriteSymInfo( WdeInfoStruct *is, bool same_as_last, char *s )
{
    bool    dirty;
    OBJPTR  obj;

    if( is->res_info->hash_table != NULL ) {
        dirty = WdeIsHashTableTouched( is->res_info->hash_table );
        if( dirty && (obj = GetMainObject()) != NULL ) {
            Forward( obj, RESOLVE_SYMBOL, NULL, NULL );
            Forward( obj, RESOLVE_HELPSYMBOL, NULL, NULL );   /* JPK */
        }
        if( !same_as_last || dirty ) {
            WdeAddSymbolsToComboBox( is->res_info->hash_table,
                                     WdeInfoWindow, IDB_INFO_IDSTR );
            WdeUntouchHashTable( is->res_info->hash_table );
        }
    } else {
        if( !same_as_last ) {
            SendDlgItemMessage( WdeInfoWindow, IDB_INFO_IDSTR, CB_RESETCONTENT, 0, 0 );
        }
    }

    if( s != NULL ) {
        WdeSetComboWithStr( s, WdeInfoWindow, IDB_INFO_IDSTR );
    }
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:26,代码来源:wdeinfo.c


示例4: RedIsolationPickupAutonomous

void RedIsolationPickupAutonomous()
{
  SensorValue[Gyroscope] = 0;
  StartTask(KeepArmInPosition);

  armPosition = minArm;
  Intake(127);
  Forward(45, 125, "none");
  StopMoving();


  Backward(127, 90, "none");
  Intake(0);
  StopMoving();

  TurnLeftDegrees(40);

  armPosition = midGoalHeight;
  wait10Msec(70);
  Intake(127);
  Forward(100, 60, "none");
  StopMoving();
  armPosition = midGoalHeight - 100;
  wait10Msec(50);
  StopTask(KeepArmInPosition);

  StopArm();

  StartTask(StayInPosition);
  wait10Msec(500);
  Intake(0);
  wait10Msec(1000);
  StopTask(StayInPosition);
}
开发者ID:joseph-zhong,项目名称:Robotics,代码行数:34,代码来源:1492xBot.c


示例5: GoStart

//Go to the start
void GoStart(void)
{
    int count=0;
    //turn left twice
    LeftTurn();
    LeftTurn();
    //go back 8 squares
    while(count<8)
    {
        //increment counters
        count++;
        Forward();
    }
    //reset current count back to zero
    count=0;
    //turn left
    LeftTurn();
    //go forward 3 squares you are at start
    while(count<2)
    {
        //increment counters
        count++;
        Forward();
    }
     	motor[motorB]=0;
			motor[motorC]=0;
      wait1Msec(1000);
}
开发者ID:c15314356,项目名称:Robotics_Project,代码行数:29,代码来源:project_xv6.c


示例6: Domain

Vector ADFun<Base>::ForOne(const Vector &x, size_t j)
{	size_t j1;

	size_t n = Domain();
	size_t m = Range();

	// check Vector is Simple Vector class with Base type elements
	CheckSimpleVector<Base, Vector>();

	CPPAD_ASSERT_KNOWN(
		x.size() == n,
		"ForOne: Length of x not equal domain dimension for f"
	);
	CPPAD_ASSERT_KNOWN(
		j < n,
		"ForOne: the index j is not less than domain dimension for f"
	);

	// point at which we are evaluating the second partials
	Forward(0, x);

	// direction in which are are taking the derivative
	Vector dx(n);
	for(j1 = 0; j1 < n; j1++)
		dx[j1] = Base(0);
	dx[j] = Base(1);

	// dimension the return value
	Vector dy(m);

	// compute the return value
	dy = Forward(1, dx);

	return dy;
}
开发者ID:iagomosqueira,项目名称:FLasher,代码行数:35,代码来源:for_one.hpp


示例7: Domain

Vector ADFun<Base>::Hessian(const Vector &x, size_t i)
{	size_t j;
	size_t k;
	size_t l;

	size_t n = Domain();
	size_t m = Range();

	// check Vector is Simple Vector class with Base type elements
	CheckSimpleVector<Base, Vector>();

	CppADUsageError(
		x.size() == n,
		"Hessian: length of x not equal domain dimension for f"
	); 
	CppADUsageError(
		i < m,
		"Hessian: index i is not less than range dimension for f"
	);

	// point at which we are evaluating the Hessian
	Forward(0, x);

	// define the return value
	Vector hes(n * n);

	// direction vector for calls to forward
	Vector u(n);
	for(j = 0; j < n; j++)
		u[j] = Base(0);

	// direction vector for calls to reverse
	Vector w(m);
	for(l = 0; l < m; l++)
		w[l] = Base(0);
	w[i] = Base(1);

	// location for return values from Reverse
	Vector ddw(n * 2);

	// loop over forward direstions
	for(j = 0; j < n; j++)
	{	// evaluate partials of entire function w.r.t. j-th coordinate
		u[j] = Base(1);
		Forward(1, u);
		u[j] = Base(0);

		// evaluate derivative of partial corresponding to F_i
		ddw = Reverse(2, w);

		// return desired components
		for(k = 0; k < n; k++)
			hes[k * n + j] = ddw[k * 2 + 1];
	}
		
	return hes;
}
开发者ID:cran,项目名称:RMC,代码行数:57,代码来源:hessian.hpp


示例8: RedInteractionCurvyAutonomous

void RedInteractionCurvyAutonomous()
{
  Intake(127);
  Forward(127, 40, "none");
  Intake(0);
  VariableMove(20, 127, 80);
  SensorValue[Gyroscope] = 0;
  Forward(127, 80, "none");
  StopMoving();
  StartTask(StayInPosition);
  wait10Msec(1500);
  StopTask(StayInPosition);
}
开发者ID:joseph-zhong,项目名称:Robotics,代码行数:13,代码来源:1492xBot.c


示例9: BSF

typeMoveList *MyPositionalGain(typePos *Position, typeMoveList *List, int av)
{
    uint64 empty = ~Position->OccupiedBW, U, T;
    int to, sq;
    typeMoveList *sm, *p, *q;
    int move;
    sm = List;
    for (U = ForwardShift(BitboardMyP & SecondSixthRanks) & empty; U; BitClear(sq, U))
    {
        to = BSF(U);
        if (OnThirdRank(to) && Position->sq[Forward(to)] == 0)
            AddGain(List, (Backward(to) << 6) | Forward(to), EnumMyP, Forward(to));
        AddGain(List, (Backward(to) << 6) | to, EnumMyP, to);
    }
    for (U = BitboardMyN; U; BitClear(sq, U))
    {
        sq = BSF(U);
        T = AttN[sq] & empty;
        AddGainTo(T, EnumMyN);
    }
    for (U = BitboardMyBL; U; BitClear(sq, U))
    {
        sq = BSF(U);
        T = AttB(sq) & empty;
        AddGainTo(T, EnumMyBL);
    }
    for (U = BitboardMyBD; U; BitClear(sq, U))
    {
        sq = BSF(U);
        T = AttB(sq) & empty;
        AddGainTo(T, EnumMyBD);
    }
    for (U = BitboardMyR; U; BitClear(sq, U))
    {
        sq = BSF(U);
        T = AttR(sq) & empty;
        AddGainTo(T, EnumMyR);
    }
    for (U = BitboardMyQ; U; BitClear(sq, U))
    {
        sq = BSF(U);
        T = AttQ(sq) & empty;
        AddGainTo(T, EnumMyQ);
    }
    sq = MyKingSq;
    T = AttK[sq] & empty &(~OppAttacked);
    AddGainTo(T, EnumMyK);
    List->move = 0;
    Sort;
    return List;
}
开发者ID:ZirconiumX,项目名称:Firenzina,代码行数:51,代码来源:move_gen.c


示例10: Domain

Vector ADFun<Base>::Hessian(const Vector &x, const Vector &w)
{	size_t j;
	size_t k;

	size_t n = Domain();

	// check Vector is Simple Vector class with Base type elements
	CheckSimpleVector<Base, Vector>();

	CPPAD_ASSERT_KNOWN(
		size_t(x.size()) == n,
		"Hessian: length of x not equal domain dimension for f"
	);
	CPPAD_ASSERT_KNOWN(
		size_t(w.size()) == Range(),
		"Hessian: length of w not equal range dimension for f"
	);

	// point at which we are evaluating the Hessian
	Forward(0, x);

	// define the return value
	Vector hes(n * n);

	// direction vector for calls to forward
	Vector u(n);
	for(j = 0; j < n; j++)
		u[j] = Base(0);


	// location for return values from Reverse
	Vector ddw(n * 2);

	// loop over forward directions
	for(j = 0; j < n; j++)
	{	// evaluate partials of entire function w.r.t. j-th coordinate
		u[j] = Base(1);
		Forward(1, u);
		u[j] = Base(0);

		// evaluate derivative of partial corresponding to F_i
		ddw = Reverse(2, w);

		// return desired components
		for(k = 0; k < n; k++)
			hes[k * n + j] = ddw[k * 2 + 1];
	}

	return hes;
}
开发者ID:barak,项目名称:CppAD-1,代码行数:50,代码来源:hessian.hpp


示例11: WdeSOP

void WdeSOP( OBJPTR obj, OBJPTR parent )
{
    LIST       *ilist, *tlist, *clist;
    WdeResInfo *info;
    RECT        orect;
    OBJPTR      sib;
    OBJ_ID      id;
    bool        clear;
    POINT       origin;

    info = WdeGetCurrentRes();
    if( info == NULL ) {
        return;
    }
    GetClientRect( info->edit_win, &orect );

    GetOffset( &origin );
    OffsetRect( &orect, origin.x, origin.y );

    if( parent == NULL ) {
        GetObjectParent( obj, &parent );
        if( parent == NULL ) {
            return;
        }
    }

    Forward( parent, GET_SUBOBJ_LIST, &tlist, NULL );

    if( tlist != NULL && WdeFindObjectsInRect( &orect, &ilist, tlist ) && ilist != NULL ) {
        clist = NULL;
        tlist = NULL;
        for( ; ilist != NULL; ilist = ListConsume( ilist ) ) {
            sib = ListElement( ilist );
            if( (Forward( sib, IS_OBJECT_CLEAR, &clear, NULL ) && clear) ||
                (Forward( sib, IDENTIFY, &id, NULL ) && id == DIALOG_OBJ) ) {
                WdeInsertObject( &clist, sib );
            } else {
                WdeInsertObject( &tlist, sib );
            }
        }
        if( clist != NULL ) {
            WdeListConcat( &tlist, clist, 0 );
            ListFree( clist );
        }
        if( tlist != NULL ) {
            WdeReorderObjectWindows( tlist );
            ListFree( tlist );
        }
    }
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:50,代码来源:wdezordr.c


示例12: ForwardBackwardAdv

 Dtype ForwardBackwardAdv(const vector<Blob<Dtype>* > & bottom) {
   Dtype loss;
   Forward(bottom, &loss);
   Backward();
   BackwardAdv();
   return loss;
 }
开发者ID:taehoonlee,项目名称:caffe,代码行数:7,代码来源:net.hpp


示例13: Domain

Vector ADFun<Base>::Jacobian(const Vector &x)
{	size_t i;
	size_t n = Domain();
	size_t m = Range();

	CPPAD_ASSERT_KNOWN(
		size_t(x.size()) == n,
		"Jacobian: length of x not equal domain dimension for F"
	);

	// point at which we are evaluating the Jacobian
	Forward(0, x);

	// work factor for forward mode
	size_t workForward = n;

	// work factor for reverse mode
	size_t workReverse = 0;
	for(i = 0; i < m; i++)
	{	if( ! Parameter(i) )
			++workReverse;
	}

	// choose the method with the least work
	Vector jac( n * m );
	if( workForward <= workReverse )
		JacobianFor(*this, x, jac);
	else	JacobianRev(*this, x, jac);

	return jac;
}
开发者ID:iagomosqueira,项目名称:FLasher,代码行数:31,代码来源:jacobian.hpp


示例14: DBGERR

bool Transceiver::Onward(IMFrame & frame)
{
        if ((frame.Header.DestinationId==myId) || (myId==0))
        {
          return false;    //this frame is for me
        }
        else
        {
           if (!Connected())
           {
              DBGERR("&NOTCNT");
              return true;
           }

           if (frame.Header.ReceiverId==myId)
           {
             if (frame.Forward())
                Forward(frame);
             else {
                Backward(frame);
             }
           } else {
              DBGERR("&NOTMY");
           }
           return true;
        }

}
开发者ID:Slyb00ts,项目名称:imwave,代码行数:28,代码来源:imtrans.cpp


示例15: WdeSetDialogMode

bool WdeSetDialogMode( WORD id )
{
    OBJPTR        obj;
    WdeOrderMode  mode;

    switch( id ) {
    case IDM_SET_ORDER:
        mode = WdeSetOrder;
        break;
    case IDM_SET_TABS:
        mode = WdeSetTabs;
        break;
    case IDM_SET_GROUPS:
        mode = WdeSetGroups;
        break;
    }

    if( (obj = WdeGetCurrentDialog()) != NULL ) {
        if( Forward( obj, SET_ORDER_MODE, &mode, NULL ) ) {
            return( TRUE );
        }
    }

    return( FALSE );
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:25,代码来源:wdemain.c


示例16: switch

void FileViewList::mousePressEvent(QMouseEvent* e) {
  switch (e->button()) {
    case Qt::XButton1:
      emit Back();
      break;
    case Qt::XButton2:
      emit Forward();
      break;
    // enqueue to playlist with middleClick
    case Qt::MidButton: {
      QListView::mousePressEvent(e);

      // we need to update the menu selection
      menu_selection_ = selectionModel()->selection();

      MimeData* data = new MimeData;
      data->setUrls(UrlListFromSelection());
      data->enqueue_now_ = true;
      emit AddToPlaylist(data);
      break;
    }
    default:
      QListView::mousePressEvent(e);
      break;
  }
}
开发者ID:Atrament666,项目名称:Clementine,代码行数:26,代码来源:fileviewlist.cpp


示例17: ForwardBackward

  Dtype ForwardBackward(const vector<Blob<Dtype>* > & bottom) {
    Dtype loss;
    Forward(bottom, &loss);
	//LOG(INFO)<<"Forward done";
    Backward();
    return loss;
  }
开发者ID:Xiaomi2008,项目名称:Caffe_3D_FF,代码行数:7,代码来源:net.hpp


示例18: ReadData

void Net::Classify(const mxArray *mx_data, mxArray *&mx_pred) {  

  //mexPrintMsg("Start classification...");
  ReadData(mx_data);
  size_t test_num = data_.size1();
  labels_.resize(test_num, layers_.back()->length_);  
  labels_.reorder(true, false);
  size_t numbatches = DIVUP(test_num, params_.batchsize_);
  size_t offset = 0;
  Mat data_batch, pred_batch;    
  for (size_t batch = 0; batch < numbatches; ++batch) {
    size_t batchsize = MIN(test_num - offset, params_.batchsize_);
    data_batch.resize(batchsize, data_.size2());
    SubSet(data_, data_batch, offset, true);    
    InitActiv(data_batch);
    Forward(pred_batch, 0);            
    SubSet(labels_, pred_batch, offset, false);    
    offset += batchsize;
    if (params_.verbose_ == 2) {
      mexPrintInt("Batch", (int) batch + 1);
    }      
  }
  labels_.reorder(kMatlabOrder, true);
  mx_pred = mexSetMatrix(labels_);  
  //mexPrintMsg("Classification finished");
}
开发者ID:Geekrick88,项目名称:ConvNet,代码行数:26,代码来源:net.cpp


示例19: Expectation

static double Expectation(DdNode **nodes_ex, int lenNodes) {
  int i;
  double rootProb, CLL = 0;

  for (i = 0; i < lenNodes; i++) {
    if (!Cudd_IsConstant(nodes_ex[i])) {
      nodesB = init_table(boolVars_ex[i]);
      nodesF = init_table(boolVars_ex[i]);

      Forward(nodes_ex[i], i);
      rootProb = GetOutsideExpe(nodes_ex[i], example_prob[i], i);

      if (rootProb <= 0.0)
        CLL = CLL + LOGZERO * example_prob[i];
      else
        CLL = CLL + log(rootProb) * example_prob[i];

      nodes_probs_ex[i] = rootProb;
      destroy_table(nodesB, boolVars_ex[i]);
      destroy_table(nodesF, boolVars_ex[i]);
    } else if (nodes_ex[i] == Cudd_ReadLogicZero(mgr_ex[i])) {
      CLL = CLL + LOGZERO * example_prob[i];
      nodes_probs_ex[i] = 0.0;
    } else
      nodes_probs_ex[i] = 1.0;
  }
  return CLL;
}
开发者ID:gokhansolak,项目名称:yap-6.3,代码行数:28,代码来源:bddem.c


示例20: first

void first(){
    switch(condition) {
        case 0:
		lineTracking();
        switch(sensor.middle_sensor) {
            case 0b00001111:
            case 0b00011111:
            case 0b00111111:
            case 0b01111111:
            case 0b00011110:
            case 0b00111110:
            condition = 1;
            break;
        }
        break;

        case 1:
		wheels.stop();
		RightTurn();
        break;

        case 2: CheckStop(); break;
        case 3: Forward(); break;
        case 4: BackToLine(); break;
        case 5: LeftTurn(); break;
        case 6:
		lineTracking();
		if(sensor.front_sensor == 0b00111100 || sensor.front_sensor == 0b00011100 || sensor.front_sensor == 0b00111000)
		{
			wheels.forward(0,0);
			condition = 6;
		}
        break;
    }
}
开发者ID:mayyuen318,项目名称:may,代码行数:35,代码来源:TowerBuilder_student.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FoundTarget函数代码示例发布时间:2022-05-30
下一篇:
C++ FormatVersion函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap