Code Monkey home page Code Monkey logo

Comments (5)

galeone avatar galeone commented on August 20, 2024

I have no idea since I don't use windows. But we treated this topic some time ago in another issue, and it looks like Go bindings on Windows are not officially supported, but if you're willing to hack a little bit it seems possible to make them work #46 (comment)

I haven't tried it since I don't have a Windows machine

from tfgo.

iFANGXIE avatar iFANGXIE commented on August 20, 2024

Hello, lucky to meet here, I also had the same problem on Windows and it was solved after trying some scenarios.

As a share, hope it helps:

(1) First you need a 64-bit gcc environment (MINGW64) and properly configured to the environment variables (so that go can be called);

(2) Next, you need to go to the Tensorflow distribution API (https://www.tensorflow.org/install/lang_c) to download the corresponding C version API;

(3) Extract to a suitable directory, then you need to add the directory to the environment variable and log out of the system to log in again.

PS: (My own solution is to directly merge 'lib' and 'include' in the file into 'lib' and 'include' under MINGW64, even if this is not easy to manage, but the configuration environment variables are omitted);The MINGW64 I use is supported by msys64.

You can then check that tensorflow's C API can be successfully called with the following simple code:

#include <stdio.h>
#include <tensorflow/c/c_api.h>
//Note: Include files start with tensorflow layers,if not find, check your environment variables
int main() {
  printf("Hello from TensorFlow C library version %s\n", TF_Version());
  return 0;
}

and Compile the sample program to create an executable file, and then run the following command:

  gcc hello_tf.c -ltensorflow -o hello_tf

  ./hello_tf

  [output]:Hello from TensorFlow C library version number

After that, you can use "go get" to continue installing 'tfgo' and determine whether it is available through the examples in the documentation

from tfgo.

galeone avatar galeone commented on August 20, 2024

hey @iFANGXIE this is great news!

This process can be helpful for other Windows users. Can you open a merge request adding this in a new section in the README?

If you speak Chinese, it would be also great if you can update the README.cn.md file. Thank you!

from tfgo.

Prayforhanluo avatar Prayforhanluo commented on August 20, 2024

Hello, lucky to meet here, I also had the same problem on Windows and it was solved after trying some scenarios.

As a share, hope it helps:

(1) First you need a 64-bit gcc environment (MINGW64) and properly configured to the environment variables (so that go can be called);

(2) Next, you need to go to the Tensorflow distribution API (https://www.tensorflow.org/install/lang_c) to download the corresponding C version API;

(3) Extract to a suitable directory, then you need to add the directory to the environment variable and log out of the system to log in again.

PS: (My own solution is to directly merge 'lib' and 'include' in the file into 'lib' and 'include' under MINGW64, even if this is not easy to manage, but the configuration environment variables are omitted);The MINGW64 I use is supported by msys64.

You can then check that tensorflow's C API can be successfully called with the following simple code:

#include <stdio.h>
#include <tensorflow/c/c_api.h>
//Note: Include files start with tensorflow layers,if not find, check your environment variables
int main() {
  printf("Hello from TensorFlow C library version %s\n", TF_Version());
  return 0;
}

and Compile the sample program to create an executable file, and then run the following command:

  gcc hello_tf.c -ltensorflow -o hello_tf

  ./hello_tf

  [output]:Hello from TensorFlow C library version number

After that, you can use "go get" to continue installing 'tfgo' and determine whether it is available through the examples in the documentation

still not work TnT

from tfgo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.