Skip to content

Commit 053dafd

Browse files
committed
Merge Variable and MutableVariable, un-deprecate registerVariable
Signed-off-by: Ryan Nett <rnett@calpoly.edu>
1 parent 93f86b1 commit 053dafd

File tree

6 files changed

+278
-362
lines changed

6 files changed

+278
-362
lines changed

tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/EagerSession.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import org.tensorflow.internal.c_api.TFE_ContextOptions;
3232
import org.tensorflow.internal.c_api.TF_Status;
3333
import org.tensorflow.proto.framework.ConfigProto;
34-
import org.tensorflow.variable.MutableVariable;
34+
import org.tensorflow.variable.Variable;
3535

3636
/**
3737
* An environment for executing TensorFlow operations eagerly.
@@ -302,15 +302,15 @@ void detach(Pointer... resources) {
302302
}
303303
}
304304

305-
private final Map<String, MutableVariable<?>> variables = new LinkedHashMap<>();
305+
private final Map<String, Variable<?>> variables = new LinkedHashMap<>();
306306

307307
@Override
308-
public void registerVariable(MutableVariable<?> variable) {
308+
public void registerVariable(Variable<?> variable) {
309309
variables.put(variable.getName(), variable);
310310
}
311311

312312
@Override
313-
public Map<String, MutableVariable<?>> variables() {
313+
public Map<String, Variable<?>> variables() {
314314
return Collections.unmodifiableMap(variables);
315315
}
316316

tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/ExecutionEnvironment.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package org.tensorflow;
1717

1818
import java.util.Map;
19-
import org.tensorflow.variable.MutableVariable;
19+
import org.tensorflow.variable.Variable;
2020

2121
/** Defines an environment for creating and executing TensorFlow {@link Operation}s. */
2222
public interface ExecutionEnvironment {
@@ -44,14 +44,12 @@ enum Types {
4444
*/
4545
Types environmentType();
4646

47-
Map<String, MutableVariable<?>> variables();
47+
Map<String, Variable<?>> variables();
4848

4949
/**
50-
* Registers a variable with this execution environment.
51-
* @deprecated Done automatically in Variable's constructor, should only be used internally.
50+
* Registers a variable with this execution environment. For internal use only.
5251
*/
53-
@Deprecated
54-
void registerVariable(MutableVariable<?> variable);
52+
void registerVariable(Variable<?> variable);
5553

5654
default boolean isEager() {
5755
return environmentType() == Types.EAGER;

tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/Graph.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
import org.tensorflow.proto.util.SaverDef;
5858
import org.tensorflow.types.TString;
5959
import org.tensorflow.types.family.TType;
60-
import org.tensorflow.variable.MutableVariable;
60+
import org.tensorflow.variable.Variable;
6161

6262

6363
/**
@@ -448,15 +448,15 @@ synchronized SaverDef saverDef() {
448448

449449
private final List<Op> initializers = new ArrayList<>();
450450

451-
private final Map<String, MutableVariable<?>> variables = new LinkedHashMap<>();
451+
private final Map<String, Variable<?>> variables = new LinkedHashMap<>();
452452

453453
@Override
454-
public void registerVariable(MutableVariable<?> variable) {
454+
public void registerVariable(Variable<?> variable) {
455455
variables.put(variable.getName(), variable);
456456
}
457457

458458
@Override
459-
public Map<String, MutableVariable<?>> variables() {
459+
public Map<String, Variable<?>> variables() {
460460
return Collections.unmodifiableMap(variables);
461461
}
462462

tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/variable/MutableVariable.java

Lines changed: 0 additions & 284 deletions
This file was deleted.

0 commit comments

Comments
 (0)