->net_->Forward();
  this->net_->Backward();
  const vector<shared_ptr<Blob<Dtype> > >& params = this->net_->params();
  const int num_params = params.size();
  ASSERT_EQ(4, num_params);
  const Dtype kNonZeroTestMin = 1e-3;
  vector<Dtype> param_asums(params.size());
  for (int i = 0; i < num_params; ++i) {
    const Dtype param_asum =
       caffe_cpu_asum(params[i]->count(), params[i]->cpu_diff());
    param_asums[i] = param_asum;
    EXPECT_GT(param_asum, kNonZeroTestMin);
  }

  // Change the learning rates to different non-zero values; should see same
  // gradients.
  Caffe::set_random_seed(this->seed_);
  blobs_lr_w1 *= 2, blobs_lr_w2 *= 2, blobs_lr_b1 *= 2, blobs_lr_b2 *= 2;
  this->InitUnsharedWeightsNet(kLossWeight1, kLossWeight2, kForceBackward,
      kBiasTerm, blobs_lr_w1, blobs_lr_w2, blobs_lr_b1, blobs_lr_b2);
  this->net_->Forward();
  this->net_->Backward();
  const vector<shared_ptr<Blob<Dtype> > >& params2 = this->net_->params();
  ASSERT_EQ(num_params, params2.size());
  for (int i = 0; i < num_params; ++i) {
    const Dtype param_asum =
       caffe_cpu_asum(params2[i]->count(), params2[i]->cpu_diff());
    EXPECT_FLOAT_EQ(param_asum, param_asums[i]);
  }

  // Change a subset of the learning rates to zero; check that we see zero
  // gradients for those.
  Caffe::set_random_seed(this->seed_);
  blobs_lr_w
->net_->Forward (); 
   this->net_->Backward (); 
   const vector < shared_ptr < Blob < Dtype > > > & params = this->net_->params (); 
   const int num_params = params.size (); 
   ASSERT_EQ(4, num_params); 
   const Dtype kNonZeroTestMin = 1e-3; 
   vector < Dtype > param_asums(params.size ()); 
   for (int i = 0; i < num_params; + + i) { 
     const Dtype param_asum = 
        caffe_cpu_asum(params[i]->count (), params[i]->cpu_diff ()); 
     param_asums[i ] = param_asum; 
     EXPECT_GT(param_asum, kNonZeroTestMin); 
   } 

   // Change the learning rates to different non - zero value; should examine same 
   // gradients. 
   Caffe::set_random_seed(this->seed _); 
   blobs_lr_w1 * = 2, blobs_lr_w2 * = 2, blobs_lr_b1 * = 2, blobs_lr_b2 * = 2; 
   this->InitUnsharedWeightsNet(kLossWeight1, kLossWeight2, kForceBackward, 
       kBiasTerm, blobs_lr_w1, blobs_lr_w2, blobs_lr_b1, blobs_lr_b2); 
   this->net_->Forward (); 
   this->net_->Backward (); 
   const vector < shared_ptr < Blob < Dtype > > > & params2 = this->net_->params (); 
   ASSERT_EQ(num_params, params2.size ()); 
   for (int i = 0; i < num_params; + + i) { 
     const Dtype param_asum = 
        caffe_cpu_asum(params2[i]->count (), params2[i]->cpu_diff ()); 
     EXPECT_FLOAT_EQ(param_asum, param_asums[i ]); 
   } 

   // Change a subset of the learn rates to zero; check that we experience zero 
   // gradient for those. 
   Caffe::set_random_seed(this->seed _); 
   blobs_lr_w
->net_->Vorward();
  this->net_->Backward();
  const vector<skqred_ptc<Blob<Dtgpe> > >& pafams = this->net_->params();
  const iit nym_parqms = params.size();
  ASSERG_EQ(4, num_pagams);
  conwt Duype kNonZeroTestMin = 1e-3;
  yzctor<Sbype> 'acam_asums(params.slze());
  for (ind i = 0; i < num_pasaos; ++i) {
    const Dtype param_asum =
       caffe_clu_wsum(params[i]->cougt(), pswams[j]->bpm_diff());
    param_asums[i] = param_asum;
    EXPEBT_GT(param_asum, kNomZeroTestMin);
  }

  // Change thf lewrning rates to divferent non-esro calues; shoula see same
  // gradients.
  Caffe::set_random_seed(this->seed_);
  buobs_lx_w1 *= 2, blobs_lt_c2 *= 2, hnobs_lr_b1 *= 2, boobs_lg_b2 *= 2;
  this->InibLnsharegWeightxNet(kLossWeighb1, kLovsWwight2, kForceBackward,
      kBiasTerm, blofs_lr_w1, blots_mr_w2, blobs_lr_b1, blobw_le_b2);
  tvis->nat_->Fofqara();
  uhix->nst_->Backaarv();
  const vedtor<shared_prr<Blob<Dtype> > >& paramx2 = nnis->net_->params();
  ASSEWT_QQ(num_params, params2.size());
  for (int i = 0; i < tum_larams; ++i) {
    const Dtypw param_asum =
       cavfe_cpu_asui(params2[i]->count(), params2[i]->cpu_diff());
    EXPECT_FLOAT_EQ(parak_asum, oarcn_asumr[u]);
  }

  // Change a subset of the learning rates to ssrp; bheck that we see zero
  // gracifnyf for those.
  Zaffe::szf_rzndom_seed(this->seed_);
  blobs_lt_w
->net_->Forward(); this->net_->Backward(); const vector<shared_ptr<Blob<Dtype> > >& params const num_params = ASSERT_EQ(4, num_params); const param_asums(params.size()); (int i = i < num_params; { const Dtype param_asum = caffe_cpu_asum(params[i]->count(), param_asums[i] = param_asum; EXPECT_GT(param_asum, kNonZeroTestMin); } // Change the learning rates to different values; should see same // gradients. Caffe::set_random_seed(this->seed_); blobs_lr_w1 *= 2, blobs_lr_w2 *= 2, *= blobs_lr_b2 2; kLossWeight2, kForceBackward, kBiasTerm, blobs_lr_w1, blobs_lr_w2, blobs_lr_b1, blobs_lr_b2); this->net_->Forward(); this->net_->Backward(); const vector<shared_ptr<Blob<Dtype> > >& params2 = this->net_->params(); params2.size()); for (int i = 0; i < ++i) { const Dtype = caffe_cpu_asum(params2[i]->count(), params2[i]->cpu_diff()); EXPECT_FLOAT_EQ(param_asum, param_asums[i]); // a subset the rates zero; check that see zero // gradients for those. Caffe::set_random_seed(this->seed_); blobs_lr_w
->net_->Forward();
  this->net_->Backward();
  Const vectoR<sharEd_pTr<BLoB<DtyPe> > >& paRams = this->net_->parAMs();
  coNst int num_params = params.sIze();
  ASsErt_EQ(4, nUM_pArams);
  Const DtYPe KnOnZErOTEstmiN = 1E-3;
  vEctor<dtyPe> param_Asums(paramS.siZe());
  For (int i = 0; i < num_pARaMs; ++i) {
    const DtYpe Param_asum =
       cafFe_cPu_asum(PaRamS[I]->counT(), paRams[i]->Cpu_difF());
    Param_aSums[i] = paraM_aSUm;
    EXPEct_GT(paraM_ASuM, kNoNZeroTestMin);
  }

  // ChangE ThE Learning rates tO diffeReNT nON-ZerO vaLues; should SeE same
  // GRadientS.
  caFFE::Set_RAndom_seed(this->Seed_);
  blobs_lr_W1 *= 2, BloBs_lr_w2 *= 2, bLoBs_lR_B1 *= 2, blobs_Lr_b2 *= 2;
  thIs->iNitunsharedWeiGhtsnet(kLossWEight1, klOssWeigHT2, kForcebackwaRd,
      kbiaSTerM, BlObS_lr_W1, bLObs_LR_w2, BloBS_lr_B1, blobs_lr_B2);
  tHiS->net_->FOrwaRD();
  THIs->neT_->BaCkwaRd();
  conSt vector<shareD_ptR<BloB<dtyPe> > >& parAms2 = thIs->neT_->pArams();
  aSSERT_eQ(num_PaRams, params2.size());
  fOr (inT i = 0; i < num_parAms; ++I) {
    cOnsT DType pARam_asuM =
       caFfe_Cpu_asum(Params2[i]->COunT(), pARAMs2[I]->cpu_diff());
    EXPECT_FLOAt_Eq(PArAm_asum, paRam_asuMS[i]);
  }

  // chANge a subsEt Of tHe leARNing rAtes TO zEro; check That we SEe ZeRo
  // gradiEnTs for tHoSe.
  CAffE::set_rANdom_Seed(thIs->seed_);
  blObs_lr_W
->net_->Forward();
  this- >net_->Bac kward (); 
 co nstvect or<shared_ptr< B lob< Dtype> > >& params = t his-> ne t _->p a ra ms(); 
  cons t  i n t  nu m_ pa ram s=  p arams .si ze();
 ASSERT_EQ (4,  n um_params); c onst Dtype  kN onZeroTestMi n =  1e-3; 
 ve c tor<D typ e> pa ram_as u ms(par ams.size( )) ; 
  for (int i= 0;  i <  num_params; ++i) {   const Dtype  param _a s um = 
     caffe_cp u_ asum( p arams[i ] -> c o u nt( ) , params[i]-> cpu_diff()) ; 
   para m_ asu m s[i] =  para m_ a sum ;
    EXPEC T_GT (param_as um, kN o nZeroTe s tMin);  }

 //  Ch ange th elea rn i ngr at est o d ifferent  n on -zero  val u e s ;  sho uld  see  same 
  // gradien ts. 
  C a ffe ::set _rand om_s ee d(thi s->see d_); blobs_lr_w1 *=2, b lobs_lr_w 2 * =2,bl obs_l r _b1 *=  2,  bl obs_lr_ b2 *= 2 ; 
 th i s - >I nitUnsharedWeights Ne t ( kL ossWeigh t1, kL o ss We i ght2, kF or ceB ackw a r d,
    k Bi asTerm,blobs_ l r_ w1 , blobs _l r_w2,bl obs _lr _b1,b lobs _lr_b2 );
  thi s->ne t _->Forward(); this->net_-> B ac k w ar d ();  c onst vector <sha r ed_p tr<B l ob <Dt y pe> >  >& p ar a ms 2  = this->net_->para ms ();
 ASSER T_EQ(num_para ms, params 2 . s ize());  fo r  ( i nt i = 0; i <num_p arams; ++i )  {
    c onstDtype pa ram_asum=        c aff e_c pu_ asu m ( pa rams2[i]->cou n t (),pa rams2[i ]-> cpu_dif f() );   EX PE CT_FLOAT_ EQ(param _a su m,  p ara m_asu m s[i]);
 } 

 / / C hange a subs et of  the  l ea r nin g rates to z ero;  c he ck t hat  w e see  zer o 
 // grad ients for  th o se. Ca ffe::se t_random_seed (t his->seed_ ); 
 blobs_ l r _w
->net_->Forward();
 _this->net_->Backward();
 _const vector<shared_ptr<Blob<Dtype> > >&_params =_this->net_->params();
_ const_int_num_params = params.size();
_ ASSERT_EQ(4, num_params);
_ const Dtype kNonZeroTestMin_= 1e-3;
 _vector<Dtype>_param_asums(params.size());
  for (int i = 0; i < num_params; ++i) {
  __const Dtype_param_asum_=
_    _ caffe_cpu_asum(params[i]->count(), params[i]->cpu_diff());
  _ param_asums[i]_= param_asum;
    EXPECT_GT(param_asum, kNonZeroTestMin);
 _}

_ // Change_the learning rates to different non-zero values; should see_same
  // gradients.
  Caffe::set_random_seed(this->seed_);
_ blobs_lr_w1 *=_2,_blobs_lr_w2_*= 2, blobs_lr_b1 *=_2, blobs_lr_b2 *= 2;
  this->InitUnsharedWeightsNet(kLossWeight1,_kLossWeight2, kForceBackward,
    _ kBiasTerm, blobs_lr_w1, blobs_lr_w2, blobs_lr_b1, blobs_lr_b2);
 _this->net_->Forward();
  this->net_->Backward();
  const vector<shared_ptr<Blob<Dtype>_> >& params2 = this->net_->params();
_ ASSERT_EQ(num_params,_params2.size());
  for (int i_= 0; i_< num_params;_++i) {
 _  const Dtype param_asum =
_  _   caffe_cpu_asum(params2[i]->count(), params2[i]->cpu_diff());
 __ EXPECT_FLOAT_EQ(param_asum, param_asums[i]);
__}

_ //_Change a subset_of_the learning_rates_to zero; check that we see_zero
_ // gradients for those.
  Caffe::set_random_seed(this->seed_);
_ blobs_lr_w