【问题标题】:Installing C API for Tensorflow on Macbook M1在 Macbook M1 上为 Tensorflow 安装 C API
【发布时间】:2022-11-11 11:36:26
【问题描述】:

我正在尝试在 Macbook M1 上安装 tensorflow 的 C API 以在 Go 中执行它。 tensorflow 开发人员遵循了这个guide,但是在使用这个命令gcc hello_tf.c -ltensorflow -o hello_tf 运行hello_tf.c 文件时卡住了。

这是hello_tf.c 文件

#include <stdio.h>
#include <tensorflow/c/c_api.h>

int main() {
  printf("Hello from TensorFlow C library version %s\n", TF_Version());
  return 0;
}

这是错误日志:

ld: warning: ignoring file /usr/local/lib/libtensorflow.2.7.0.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
  "_TF_Version", referenced from:
      _main in hello_tf-6f1778.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation

关于如何修复编译的任何建议?

【问题讨论】:

    标签: c tensorflow go apple-m1 c-api


    【解决方案1】:

    Here's 有关如何从头开始构建版本的指南,因为过时或旧版本的软件通常更难安装,尤其是在库方面。

    【讨论】:

    • 它起作用了(尽管编译那些 C 文件需要几个小时)。谢谢!
    【解决方案2】:

    如果您不需要最新版本的 Tensorflow,这里有不同版本的编译和准备: https://github.com/vodianyk/libtensorflow-cpu-darwin-arm64

    【讨论】:

      猜你喜欢
      • 2023-02-20
      • 1970-01-01
      • 2021-05-17
      • 2021-10-30
      • 1970-01-01
      • 2021-11-21
      • 2022-01-18
      • 1970-01-01
      • 2021-04-22
      相关资源
      最近更新 更多