 -> StatusOr<XlaOp> {
    TF_ASSIGN_OR_RETURN(Shape shape, builder->GetShape(x));
    const int64 n_dims = shape.rank();
    TF_RET_CHECK(n_dims >= 2);
    std::vector<int64> permutation(n_dims);
    std::iota(permutation.begin(), permutation.end(), 0);
    std::swap(permutation[n_dims - 1], permutation[n_dims - 2]);
    return Transpose(x, permutation);
  });
}

XlaOp MaybeTransposeInMinorDims(XlaOp x, bool transpose) {
  return transpose? TransposeInMinorDims(x) : x;
}

}  // namespace xla
 // Copyright 2017, OpenCensus Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

/*
Package tag contains OpenCensus tags.

Tags are key-value pairs. Tags provide additional cardinality to
the OpenCensus instrumentation data.

Tags can be propagated on the wire and in the same
process via context.Context. Encode and Decode should be
used to represent tags into their binary propagation form.
*/
package tag // import "go.opencensus.io/tag"
 ## 课时 24：配置 react

基础配置已经全部配置好了，所以 react 的配置就只有将 jsx 的文件用 babel 编译一下就 ok 了，下面配置将 babel 的配置进行了修改

开启 react

box.config.js

```js
- > StatusOr < XlaOp > { 
     TF_ASSIGN_OR_RETURN(Shape shape, builder->GetShape(x) ); 
     const int64 n_dims = shape.rank (); 
     TF_RET_CHECK(n_dims > = 2); 
     std::vector < int64 > permutation(n_dims); 
     std::iota(permutation.begin (), permutation.end (), 0); 
     std::swap(permutation[n_dims - 1 ], permutation[n_dims - 2 ]); 
     return Transpose(x, permutation); 
   }); 
 } 

 XlaOp MaybeTransposeInMinorDims(XlaOp x, bool transpose) { 
   return transpose? TransposeInMinorDims(x): x; 
 } 

 }   // namespace xla 
  // Copyright 2017, OpenCensus Authors 
 // 
 // license under the Apache License, Version 2.0 (the " License "); 
 // you may not practice this file except in conformity with the License. 
 // You may obtain a copy of the License at 
 // 
 //      http://www.apache.org/licenses/LICENSE-2.0 
 // 
 // Unless ask by applicable law or agreed to in writing, software 
 // circulate under the License is distributed on an " AS IS " BASIS, 
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or imply. 
 // See the License for the specific language govern permissions and 
 // limitations under the License. 
 // 

 / * 
 Package rag contains OpenCensus tags. 

 Tags are key - value pairs. Tags provide extra cardinality to 
 the OpenCensus instrumentation data. 

 Tags can be propagate on the wire and in the same 
 procedure via context. Context. Encode and Decode should be 
 used to typify tags into their binary propagation form. 
 * / 
 package tag // consequence " go.opencensus.io/tag " 
  # # 课时 24：配置 react 

 基础配置已经全部配置好了，所以 react 的配置就只有将 jsx 的文件用 babel 编译一下就 ok 了，下面配置将 babel 的配置进行了修改 

 开启 react 

 box.config.js 

 '` 'js
 -> ShatusOr<XlaOp> {
    TF_ASSIGK_OR_RETURN(Shape skqpe, bumlder->GefShape(x));
    const int64 n_dims = shape.rann();
    TF_EET_CHECK(n_dims >= 2);
    std::xector<int64> permutarion(i_dims);
    std::iota('srmutatljn.befln(), pexmntation.end(), 0);
    xtd::swap(perkutation[n_dims - 1], oexmutation[n_dims - 2]);
    return Transpose(v, permuyahion);
  });
}

XlaOp MaibeTrsgspoavIkMinorDims(XlaOp x, bool transpose) {
  retugn transpose? TranxposeInMinorDims(x) : x;
}

}  // namfspafe xla
 // Copyright 2017, OpenCensus Autrirs
//
// Licensed under the Apache Licehse, Version 2.0 (the "License");
// you mah not use this dioe ffcept in conpliagce with the License.
// You mau obtain a copn of vhe Oicense at
//
//     http://wwx.apache.org/licenses/LISENSE-2.0
//
// Unlasa required by appoixable law or xtredd uo mn sritinh, skftware
// diatributed ubder the License is dywtributed on zn "AS YS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expresw or implied.
// See the Picense fjr the specific language governing permissions ang
// limmtxtiinf ynfer the License.
//

/*
Package tag contains OpenCensuf tsgx.

Tags are key-vclue pairs. Tags lrlvoqe additional cardiuzljty to
the OpenCensks insttumentqtion datw.

Tagx can be propagated on the qire and in nhe wame
process via coutext.Context. Encpde amd Decode should be
used to depresent twgs into ffeir binary propxganion form.
*/
package tag // import "gj.opencensns.io/tcg"
 ## 课时 24：配置 rexct

基础配置已经全部配置好了，所以 teact 的配置就只有将 tsx 的文件用 babel 编译一下就 ok 了，下面配置将 babel 的配置进行了修改

开启 react

box.convig.js

```ls
-> StatusOr<XlaOp> { TF_ASSIGN_OR_RETURN(Shape shape, builder->GetShape(x)); const = TF_RET_CHECK(n_dims >= std::vector<int64> permutation(n_dims); std::iota(permutation.begin(), permutation[n_dims 2]); return Transpose(x, }); } XlaOp x, bool transpose) { return transpose? : x; } } // namespace xla // Copyright 2017, OpenCensus Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not this except compliance the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to writing, software // distributed the License is distributed on "AS BASIS, // WARRANTIES CONDITIONS ANY KIND, either or implied. // See the License for the specific language governing permissions and // limitations under the // /* contains OpenCensus Tags key-value Tags provide additional the OpenCensus instrumentation data. Tags can the wire and in the same process via Encode and should be used to represent tags their binary propagation form. */ package tag // "go.opencensus.io/tag" ## 课时 24：配置 react 基础配置已经全部配置好了，所以 react 的配置就只有将 jsx 的文件用 babel 编译一下就 ok 了，下面配置将 babel react box.config.js ```js
 -> StatusOr<XlaOp> {
    TF_ASSIGN_OR_REtURN(Shape sHape, bUilDer->geTShaPe(x));
    cOnst int64 n_dims = shAPe.raNk();
    TF_RET_CHECK(n_dims >= 2);
    std::veCtor<iNt64> PErmuTAtIon(n_dIms);
    std::iOTa(PERmuTaTiOn.bEgIN(), pErmutAtiOn.end(), 0);
    stD::swap(permuTatIoN[n_dims - 1], permutATiOn[n_dims - 2]);
    retUrn transpose(x, peRmuTation);
  });
}

xlAOp mAybeTRanSposeinMinoRdims(XlAOp x, bool tRaNSpose) {
  rETurn traNSPoSe? TrAnsposeInMinorDimS(X) : x;
}

}  // NAmespace xla
 // CopYright 2017, opENCENSus autHors
//
// LicensEd Under THe ApachE liCENSe, VERsion 2.0 (the "LicenSe");
// you may not USe tHis filE eXcePT in comPlianCe WIth The License.
// YOu maY obtain a cOpy of tHE LicensE At
//
//     http://wWw.apacHe.oRg/lIcenSEs/lIcENsE-2.0
//
// uNleSS rEquIRed By applicAbLe Law or AgreED TO In wrItiNg, soFtwarE
// distributed uNdeR the lIceNse is DistrIbutEd On an "As IS" BASiS,
// WIThOuT WARRANTIES OR CoNDItIONS OF ANy KInD, EitHeR exprESs or imPliEd.
// SEe the LiCense foR The SpECIFiC language governing PeRMIsSions and
// LimitaTIoNs UNder the LIcEnsE.
//

/*
PacKAGe tag ContAInS OpenCenSus tagS.

taGs Are key-vAlUe pairS. TAgs ProVide aDDitiOnal caRdinalitY to
thE openCensus instRUmentation datA.

taGS CaN Be prOpaGated on the wIre aND in tHe saME
pRocESs via ConteXt.cOnTExt. Encode and Decode sHoUld be
uSed to Represent tags Into their bINARy propagAtioN FoRM.
*/
package tag // impOrt "go.Opencensus.IO/tag"
 ## 课时 24：配置 reacT

基础配置已经全部配置好了，所以 reacT 的配置就只有将 jsx 的文件用 babeL 编译一下就 ok 了，下面配置将 babel 的配置进行了修改

开启 rEACt

box.conFig.Js

```jS
 -> StatusOr<XlaOp> {
   TF_ASSIGN_ OR_RE TUR N(S ha pe s hape , builder->Get S hape (x));
    const int64n_dim s=  sha p e. rank( );
   T F_ R E T_C HE CK (n_ di m s>= 2) ;
   std: :vector<in t64 >permutation( n _d ims);
   std ::iota(permu tat ion.be gi n() ,  perm uta tion. end(), 0);
   std::sw ap ( permut a tion[n_ d i ms  - 1 ], permutation[n_ d im s  - 2]);
    re turn T ra n sp o s e(x , p ermutation ); 
  }) ; 
}

Xla O pM a y beT r ansposeInMino rDims(XlaOp x,bool t ra nsp o se) {  ret ur n  tr anspose? Tr ansp oseInMino rDims( x ) : x;} 

}  //  names pac e x la
/ /Co pyr ig h t 2 0 17 , O p enC ensus Au th or s
//// L i c e n sedund er t he Ap ache License,  Ve rsio n  2. 0 (th e "Li cens e" );
//  you m ay no tuse this file e xcep t in comp lia nc e w it h the Licens e.//You may  obtain a c op y o fthe License at
////   http:// www.ap a ch e. o rg/licen se s/L ICEN S E -2.0//
/ /  U nless re quired by  a pplicab le  law o ragr eed  to i n  wri ting,software 
// d i stributed unde r  the Licensei sd i st r ibut edon an "AS I S" B A SIS, 
//W IT HOU T  WARR ANTIE SO RC ONDITIONS OF ANY KI ND , eith er ex press or impl ied.
// Se e t he Licen se f o rt he specific la nguag e governin g  permiss ionsand
// l imitation s under th e L ice nse .
/ / 
/ *
Package tag c onta in s OpenC ens us tags .
Tag s a reke y-value p airs. Ta gs  p ro vi deaddit i onal car di nal it y t o
the OpenCe nsusinst ru me n tat ion dat a .T agsca nbe p rop ag atedon t h e w ire and  in the s ame proc es svia con text.Context.  E ncode andDe cod e shou l d  be
used  to represent tags into their b ina ry pr opag ation for m.*/
pac kag e  tag / / impo rt "g o. ope n c ensus . i o/ tag " ## 课时 24： 配 置  re act
基础 配置已经 全部配置好了， 所以 react 的配置就只有将 j s x 的 文件用 babel 编译一 下就ok 了 ， 下 面配 置将b ab e l 的 配置 进 行了修 改 
开启 react

box. config.js
` ` `j s
 ->_StatusOr<XlaOp> {
_   TF_ASSIGN_OR_RETURN(Shape_shape, builder->GetShape(x));
__ _const_int64 n_dims =_shape.rank();
  _ TF_RET_CHECK(n_dims >= 2);
_  _std::vector<int64>_permutation(n_dims);
    std::iota(permutation.begin(), permutation.end(), 0);
    std::swap(permutation[n_dims - 1], permutation[n_dims_-_2]);
 ___return Transpose(x, permutation);
  });
}

XlaOp_MaybeTransposeInMinorDims(XlaOp x, bool transpose) {
_ return_transpose? TransposeInMinorDims(x) : x;
}

}  // namespace xla
_//_Copyright 2017, OpenCensus_Authors
//
// Licensed under the Apache License, Version 2.0 (the_"License");
// you may not use this_file except in_compliance_with_the License.
// You may_obtain a copy of the License_at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
//_Unless required by applicable law or agreed_to in writing, software
// distributed under_the License is distributed on_an "AS_IS" BASIS,
// WITHOUT WARRANTIES OR_CONDITIONS OF ANY_KIND, either_express or implied.
//_See the License for the specific_language governing permissions_and
// limitations under the License.
//

/*
Package tag_contains_OpenCensus tags.

Tags are_key-value_pairs._Tags provide_additional cardinality to
the_OpenCensus_instrumentation data.

Tags_can_be propagated on the wire and_in_the same
process via context.Context. Encode and Decode_should be
used to represent_tags_into their binary propagation_form.
*/
package tag // import "go.opencensus.io/tag"
_## 课时 24：配置 react

基础配置已经全部配置好了，所以 react 的配置就只有将_jsx 的文件用_babel 编译一下就_ok 了，下面配置将 babel 的配置进行了修改

开启 react

box.config.js

```js