tensorflow / tensorflow/java

How to add training = True in tensorflow-java?

Open
#284 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
928
Forks
227
PR merge metrics
No merged PRs in 30d

Description

The models that I have from Python works only if I provide training = True as well in Python.

for instance in Python;

import tensorflow as tf
my_model = tf.keras.models.load_model("model")
prdct = my_model(input_image, training = True)

Here, if I do not provide training = True, the values in prdct.numpy() are all "nan".

I have the same problem in tensorflow/java as well. I wonder if there is a way to give option training = True in tensorflow/java?
Here is the java code:

        TFloat32 ImagePredicted = (TFloat32) sess
        		.runner()
        		.feed(input_layer, inputTensor)
        		.fetch(outputLayer)
        		.run()
        		.get(0);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Java Runner code shown in the issue and inspect how the loaded model exposes inputs and options compared with the Python call's training argument. Determine whether the Java API can pass this setting for the exported model, and document or validate the supported behavior with a focused example or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, tensorflow
Domain
api, machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.