How to represent the [variable_scope] and [get_variable] in tensorflow java ?

Open
#433 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
30/100
Issue type
Documentation
Clarity
Needs clarification
Activity status
Stale
Tech stack
java, tensorflow

Research direction

Start by checking the TensorFlow Java API documentation for equivalents to the Python variable_scope and get_variable APIs shown in the issue. Provide a Java example covering the requested variable creation and scoping behavior, and clarify whether a direct equivalent exists.

Written by the indexing model from the issue text.

Description

HI :
write the tensorflow code in python ,we always use with the variable_scope and get_variable method , like this

        with tf.compat.v1.variable_scope('Qifficulty'):
            question_difficulty_weights = tf.compat.v1.get_variable('weights', [q.get_shape()[-1], 1],
                                                          initializer= tf.initializers.glorot_uniform(seed=0))
                                                          # layers.xavier_initializer(seeed=0))
            question_difficulty_biases = tf.compat.v1.get_variable('biases', [1],
                                                         initializer=tf.compat.v1.zeros_initializer())
            question_difficulty = tf.nn.tanh(tf.matmul(q, question_difficulty_weights) + question_difficulty_biases)
 but in  java ,we can not use  with key word , and   I also can not  find [variable_scope] and [get_variable]  two apis.  

I just want to know How to represent the [variable_scope] and [get_variable] in tensorflow java ,could we give me a damo about these?

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

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.

More from tensorflow/java

All issues in tensorflow/java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.