为什么我无法将张量的rsqrt op值分配给Eigen :: Tensor <T,0>

时间:2019-07-18 12:46:50

标签: c++ tensorflow eigen

auto linear_square = linear * linear;
auto linear_square_sum = linear_square.sum().sqrt();

如果我指出linear_square_sum的值,我会看到一个数字。现在,我想获取linear_square.sum()。sqrt()的标量值,因此我将其类型为Eigen :: Tensor赋予如下代码,

auto linear_square = linear * linear;
Eigen::Tensor<T,0> linear_square_sum = linear_square.sum().sqrt();

不幸的是,它给出了一些错误。 linear_square.sum()。sqrt()的实际类型是

see here

,错误是

  

external / eigen_archive / unsupported / Eigen / CXX11 / src / Tensor / TensorAssign.h:127:5:   错误:静态断言失败:YOU_MADE_A_PROGRAMMING_MISTAKE   外部/ eigen_archive /不支持/Eigen/CXX11/src/Tensor/TensorAssign.h:   在'Eigen :: TensorEvaluator的实例中,   Device> :: TensorEvaluator(const XprType&,const Device&)[with   LeftArgType = Eigen :: TensorFixedSize,0,long int>; RightArgType =   const Eigen :: TensorCwiseUnaryOp,const Eigen :: TensorReductionOp,const   特征码:: DimensionList,常数特征码:: TensorCwiseBinaryOp,常数   Eigen :: TensorChippingOp <0,Eigen :: TensorMap,16,Eigen :: MakePointer>

     
    

,const Eigen :: TensorChippingOp <0,Eigen :: TensorMap,16,Eigen :: MakePointer>>>,Eigen :: MakePointer>>;设备=     Eigen :: DefaultDevice; Eigen :: TensorEvaluator,Device> :: XprType =     Eigen :: TensorAssignOp,0,long int>,const Eigen :: TensorCwiseUnaryOp,     const Eigen :: TensorReductionOp,const Eigen :: DimensionList,const     Eigen :: TensorCwiseBinaryOp,const Eigen :: TensorChippingOp <0,     Eigen :: TensorMap,16,Eigen :: MakePointer>>,const     Eigen :: TensorChippingOp <0,Eigen :: TensorMap,16,Eigen :: MakePointer>>     ,Eigen :: MakePointer>>>]':external / eigen_archive / unsupported / Eigen / CXX11 / src / Tensor / TensorExecutor.h:88:41:     从'static void Eigen :: internal :: TensorExecutor :: run(const     Expression&,const Device&)[with Expression = const     Eigen :: TensorAssignOp,0,long int>,const Eigen :: TensorCwiseUnaryOp,     const Eigen :: TensorReductionOp,const Eigen :: DimensionList,const     Eigen :: TensorCwiseBinaryOp,const Eigen :: TensorChippingOp <0,     Eigen :: TensorMap,16,Eigen :: MakePointer>>,const     Eigen :: TensorChippingOp <0,Eigen :: TensorMap,16,Eigen :: MakePointer>>     ,Eigen :: MakePointer>>>;设备= Eigen :: DefaultDevice; bool Vectorizable = false; bool Tileable = false]'     外部/ eigen_archive /不支持/Eigen/CXX11/src/Tensor/TensorFixedSize.h:328:65:     必须来自'Eigen :: TensorFixedSize :: TensorFixedSize(const     Eigen :: TensorBase&)[with OtherDerived = Eigen :: TensorCwiseUnaryOp,     const Eigen :: TensorReductionOp,const Eigen :: DimensionList,const     Eigen :: TensorCwiseBinaryOp,const Eigen :: TensorChippingOp <0,     Eigen :: TensorMap,16,Eigen :: MakePointer>>,const     Eigen :: TensorChippingOp <0,Eigen :: TensorMap,16,Eigen :: MakePointer>>     ,Eigen :: MakePointer>>;标量= Eigen ::一半; Dimensions_ = Eigen :: Sizes <0>; int Options_ = 0; IndexType = long int]'     tensorflow / core / kernels / training_ops.cc:2871:13:从'void必需     tensorflow :: SparseApplyGFtrlOp :: Compute(tensorflow :: OpKernelContext *)     [使用Device = Eigen :: ThreadPoolDevice; T = Eigen ::一半; Tindex =长     长整数bool has_l2_shrinkage = false]'     tensorflow / core / kernels / training_ops.cc:4684:1:从此处开始     外部/ eigen_archive /不受支持/Eigen/CXX11/src/Tensor/TensorAssign.h:127:5:     错误:静态声明失败:YOU_MADE_A_PROGRAMMING_MISTAKE目标     // tensorflow / tools / pip_package:build_pip_package无法构建

  

0 个答案:

没有答案