• tensoflow 编译


    https://www.tensorflow.org/install/source
    https://blog.csdn.net/u011285477/article/details/93975689

    https://blog.csdn.net/u012614287/article/details/90415545
    ./configure  # answer prompts or use defaults
    
    bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
    
    ./bazel-bin/tensorflow/tools/pip_package/build_pip_package /mnt  # create package
    
    chown $HOST_PERMS /mnt/tensorflow-version-tags.whl
    pip uninstall tensorflow  # remove current version
    
    pip install /mnt/tensorflow-version-tags.whl
    cd /tmp  # don't import from source directory
    python -c "import tensorflow as tf; print(tf.__version__)"
    bazel build --config=opt //tensorflow:libtensorflow_cc.so
    

      

     
    sudo docker run -it  --name=tongxiao_tensorflow --net=host  -w /tensorflow -v /mnt/sdi/tongxiao.wzb/tensorflow:/tensorflow -v $PWD:/mnt -e HOST_PERMS="$(id -u):$(id -g)" tensorflow/tensorflow:devel bash
    g++ -o test test.cc --std=c++11 -I../eigen/eigen-master -I../../tensorflow/tensorflow/third_party -I../../tensorflow/tensorflow -L./lib -ltensorflow_cc -ltensorflow_framework -I/usr/local/lib/python3.6/dist-packages/tensorflow/include/
    
    https://gitlab.com/libeigen/eigen
    

      

    #include "tensorflow/cc/client/client_session.h"
    #include "tensorflow/cc/ops/standard_ops.h"
    #include "tensorflow/core/framework/tensor.h"
    
    int main() {
      using namespace tensorflow;
      using namespace tensorflow::ops;
      Scope root = Scope::NewRootScope();
      // Matrix A = [3 2; -1 0]
      auto A = Const(root, { {3.f, 2.f}, {-1.f, 0.f}});
      // Vector b = [3 5]
      auto b = Const(root, { {3.f, 5.f}});
      // v = Ab^T
      auto v = MatMul(root.WithOpName("v"), A, b, MatMul::TransposeB(true));
      std::vector<Tensor> outputs;
      ClientSession session(root);
      // Run and fetch v
      TF_CHECK_OK(session.Run({v}, &outputs));
      // Expect outputs[0] == [19; -3]
      std::cout<< outputs[0].matrix<float>();
      return 0;
    }
    

  • 相关阅读:
    [jdk] JDK1.5新特性
    [maven] maven介绍
    [Ant] bulid.xml配置详解
    [spring] spring面试题
    .net(C#)时间相减、C#计算时间间隔
    如何记录应用程序日志
    交换机、集线器、路由器区别和使用浅谈
    ASP.NET 在域控制器上使用默认 ASPNET 帐户不能正常运行
    .NET 4中Entity Framework简介
    WCF传输性能测试
  • 原文地址:https://www.cnblogs.com/mysqlinternal/p/14704717.html
Copyright © 2020-2023  润新知