Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
imagej-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
imagej-elphel
Commits
936a319d
Commit
936a319d
authored
Sep 11, 2018
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working with CUDA 9.0 installed
parent
fdc29260
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
1 deletion
+39
-1
pom.xml
pom.xml
+6
-1
TensorflowExamplePlugin.java
src/main/java/TensorflowExamplePlugin.java
+33
-0
No files found.
pom.xml
View file @
936a319d
...
@@ -39,7 +39,12 @@
...
@@ -39,7 +39,12 @@
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.tensorflow
</groupId>
<groupId>
org.tensorflow
</groupId>
<artifactId>
tensorflow
</artifactId>
<artifactId>
libtensorflow
</artifactId>
<version>
1.10.0
</version>
</dependency>
<dependency>
<groupId>
org.tensorflow
</groupId>
<artifactId>
libtensorflow_jni_gpu
</artifactId>
<version>
1.10.0
</version>
<version>
1.10.0
</version>
</dependency>
</dependency>
<dependency>
<dependency>
...
...
src/main/java/TensorflowExamplePlugin.java
View file @
936a319d
...
@@ -3,11 +3,44 @@
...
@@ -3,11 +3,44 @@
* SPDX-License-Identifier: GPL-3.0-or-later
* SPDX-License-Identifier: GPL-3.0-or-later
*/
*/
import
org.tensorflow.Graph
;
import
org.tensorflow.Session
;
import
org.tensorflow.Tensor
;
import
org.tensorflow.TensorFlow
;
public
class
TensorflowExamplePlugin
public
class
TensorflowExamplePlugin
{
{
public
void
run
()
public
void
run
()
{
{
System
.
out
.
println
(
"TensorflowExamplePlugin run"
);
System
.
out
.
println
(
"TensorflowExamplePlugin run"
);
try
{
main
();
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
}
public
static
void
main
()
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
);
// Generally, there may be multiple output tensors, all of them must be closed to prevent resource leaks.
Tensor
output
=
s
.
runner
().
fetch
(
"MyConst"
).
run
().
get
(
0
))
{
System
.
out
.
println
(
new
String
(
output
.
bytesValue
(),
"UTF-8"
));
s
.
close
();
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment