At present, AI is very hot. I have seen TensorFlow these days. The official description of TensorFlow is as follows:

TensorFlow is an open source software library that uses data flow diagrams for numerical calculations. The nodes in the graph represent mathematical operations, and the edges in the graph represent multidimensional arrays (tensors) that are passed between these nodes. With this flexible architecture, you can deploy computing to one or more cpus or Gpus on a desktop device, server, or mobile device through an API.

TensorFlow website

The eclipse+JDK environment does not explain how to set up the TensorFlow environment

TensorFlow JDK + eclipse environment

1. Downloadlibtensorflow.jarThis is TensorFlow Java archive (JAR).
2. DownloadTensorFlow for Java on WindowsJava native interface (JNI) files.
3. Decompress the zip file to extract the. DLL file.
4. Create a Java project in Eclipse, I directly use the example given on the official website, the code is as follows
public class HelloTF {
	public static void main(String[] args) throws Exception {
		try (Graph g = new Graph()) {
			final String value = "Hello from " + TensorFlow.version();

			// Construct the computation graph with a single operation, a constant
			// named "MyConst" with a value "value".
			try (Tensor t = Tensor.create(value.getBytes("UTF-8"))) {
				// The Java API doesn't yet include convenience functions for adding operations. g.opBuilder("Const", "MyConst").setAttr("dtype", t.dataType()).setAttr("value", t).build(); } // Execute the "MyConst" operation in a Session. try (Session s = new Session(g); Tensor output = s.runner().fetch("MyConst").run().get(0)) { System.out.println(new String(output.bytesValue(), "UTF-8")); }}}}Copy the code
Libtensorflow. jar is added to the Java project. If you do not add this jar, the application will not find the related classes
Tensorflow_jni. DLL file is copied to the SRC directory of the project. The second step is to right-click the properties of the project — “Java Build Path >Source”. Click the arrow on the left of Source to select native Library, click Edit on the right, and select the project’s SRC directory.

Hello from 1.6.0
Copy the code

For other languages, please refer to the official website