Do TensorFlow in Java. It's easy, though. .. .. ..

Speaking of machine learning, TensorFlow developed by Google is famous.

In fact, you can use TensorFlow even with Java, which everyone loves. Moreover, it is very easy to use. Just add one library to your build.

compile 'org.tensorflow:tensorflow:1.7.0'

The whole build.gradle is here

This alone will make the sample code work.

Sample excerpt


try (Graph g = new Graph(); Session session = new Session(g)) {
	Tensor<?> t = Tensor.create("First TensorFlow".getBytes());
	g.opBuilder("Const", "message").setAttr("dtype", t.dataType()).setAttr("value", t).build();
	Tensor<?> out = session.runner().fetch("message").run().get(0);
	System.out.println(new String(out.bytesValue()));
}

↓ Output to TensorFlow and console for the first time.

The entire sample code is here

It's very easy to set up a machine learning environment.

However. .. ..

Judgment can be done in Java, but the first learning needs to be done elsewhere, such as Python or C. I hope I can do it in Java from the beginning!

Recommended Posts

Do TensorFlow in Java. It's easy, though. .. .. ..
Do Scala Option.or Null in Java
Do HelloWorld in Java / IntelliJ / Gradle
[Java] Do not use "+" in append!
Do you use Stream in Java?
Easy to make Slack Bot in Java
How to do base conversion in Java
Do not declare variables in List in Java
Partization in Java
Changes in Java 11
Rock-paper-scissors in Java
Pi in Java
FizzBuzz in Java
I want to do something like "cls" in Java
It's late! Try implementing Android Notification in Java (Beginner)
[java] sort in list
Read JSON in Java
Interpreter implementation in Java
Make Blackjack in Java
Rock-paper-scissors app in Java
Constraint programming in Java
Put java8 in centos7
Combine arrays in Java
"Hello World" in Java
Callable Interface in Java
Comments in Java source
Azure functions in java
Format XML in Java
Simple htmlspecialchars in Java
Boyer-Moore implementation in Java
Hello World in Java
Use OpenCV in Java
webApi memorandum in java
Type determination in Java
Ping commands in Java
Various threads in java
Zabbix API in Java
ASCII art in Java
Compare Lists in Java
POST JSON in Java
Express failure in Java
Create JSON in Java
Date manipulation in Java 8
What's new in Java 8
Use PreparedStatement in Java
What's new in Java 9,10,11
Parallel execution in Java
Initializing HashMap in Java
It's late! Try implementing Android Work Manager in Java (Beginner)
Easy way to check method / field list in Java REPL