Skip to content

Commit a9ff547

Browse files
committed
Move Shape to upper level
1 parent a507e84 commit a9ff547

File tree

190 files changed

+430
-419
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+430
-419
lines changed

tensorflow-core/tensorflow-core-api/src/bazel/op_generator/op_specs.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ std::pair<Type, Type> TypeResolver::TypesOf(const OpDef_AttrDef& attr_def,
148148
types = MakeTypePair(Type::Class("Boolean"), Type::Boolean());
149149

150150
} else if (attr_type == "shape") {
151-
types = MakeTypePair(Type::Class("Shape", "org.tensorflow.util.ndarray"));
151+
types = MakeTypePair(Type::Class("Shape", "org.tensorflow.util"));
152152

153153
} else if (attr_type == "tensor") {
154154
types = MakeTypePair(Type::Class("Tensor", "org.tensorflow")

tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/DataOps.java

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import org.tensorflow.types.TBool;
2020
import org.tensorflow.types.TInt64;
2121
import org.tensorflow.types.TString;
22-
import org.tensorflow.util.ndarray.Shape;
22+
import org.tensorflow.util.Shape;
2323

2424
/**
2525
* An API for building {@code data} operations as {@link Op Op}s
@@ -34,17 +34,30 @@ public final class DataOps {
3434
}
3535

3636
/**
37-
* Builds an {@link OptionalGetValue} operation
37+
* Builds an {@link IteratorGetNext} operation
3838
*
39-
* @param optional
39+
* @param iterator
4040
* @param outputTypes
4141
* @param outputShapes
42-
* @return a new instance of OptionalGetValue
43-
* @see org.tensorflow.op.data.OptionalGetValue
42+
* @return a new instance of IteratorGetNext
43+
* @see org.tensorflow.op.data.IteratorGetNext
4444
*/
45-
public OptionalGetValue optionalGetValue(Operand<?> optional, List<DataType<?>> outputTypes,
45+
public IteratorGetNext iteratorGetNext(Operand<?> iterator, List<DataType<?>> outputTypes,
4646
List<Shape> outputShapes) {
47-
return OptionalGetValue.create(scope, optional, outputTypes, outputShapes);
47+
return IteratorGetNext.create(scope, iterator, outputTypes, outputShapes);
48+
}
49+
50+
/**
51+
* Builds an {@link AnonymousIterator} operation
52+
*
53+
* @param outputTypes
54+
* @param outputShapes
55+
* @return a new instance of AnonymousIterator
56+
* @see org.tensorflow.op.data.AnonymousIterator
57+
*/
58+
public AnonymousIterator anonymousIterator(List<DataType<?>> outputTypes,
59+
List<Shape> outputShapes) {
60+
return AnonymousIterator.create(scope, outputTypes, outputShapes);
4861
}
4962

5063
/**
@@ -78,6 +91,16 @@ public DeserializeIterator deserializeIterator(Operand<?> resourceHandle, Operan
7891
return DeserializeIterator.create(scope, resourceHandle, serialized);
7992
}
8093

94+
/**
95+
* Builds an {@link OptionalNone} operation
96+
*
97+
* @return a new instance of OptionalNone
98+
* @see org.tensorflow.op.data.OptionalNone
99+
*/
100+
public OptionalNone optionalNone() {
101+
return OptionalNone.create(scope);
102+
}
103+
81104
/**
82105
* Builds an {@link IteratorGetNextAsOptional} operation
83106
*
@@ -92,16 +115,6 @@ public IteratorGetNextAsOptional iteratorGetNextAsOptional(Operand<?> iterator,
92115
return IteratorGetNextAsOptional.create(scope, iterator, outputTypes, outputShapes);
93116
}
94117

95-
/**
96-
* Builds an {@link OptionalNone} operation
97-
*
98-
* @return a new instance of OptionalNone
99-
* @see org.tensorflow.op.data.OptionalNone
100-
*/
101-
public OptionalNone optionalNone() {
102-
return OptionalNone.create(scope);
103-
}
104-
105118
/**
106119
* Builds an {@link OptionalFromValue} operation
107120
*
@@ -113,6 +126,20 @@ public OptionalFromValue optionalFromValue(Iterable<Operand<?>> components) {
113126
return OptionalFromValue.create(scope, components);
114127
}
115128

129+
/**
130+
* Builds an {@link IteratorGetNextSync} operation
131+
*
132+
* @param iterator
133+
* @param outputTypes
134+
* @param outputShapes
135+
* @return a new instance of IteratorGetNextSync
136+
* @see org.tensorflow.op.data.IteratorGetNextSync
137+
*/
138+
public IteratorGetNextSync iteratorGetNextSync(Operand<?> iterator, List<DataType<?>> outputTypes,
139+
List<Shape> outputShapes) {
140+
return IteratorGetNextSync.create(scope, iterator, outputTypes, outputShapes);
141+
}
142+
116143
/**
117144
* Builds an {@link IteratorToStringHandle} operation
118145
*
@@ -124,19 +151,6 @@ public IteratorToStringHandle iteratorToStringHandle(Operand<?> resourceHandle)
124151
return IteratorToStringHandle.create(scope, resourceHandle);
125152
}
126153

127-
/**
128-
* Builds an {@link AnonymousIterator} operation
129-
*
130-
* @param outputTypes
131-
* @param outputShapes
132-
* @return a new instance of AnonymousIterator
133-
* @see org.tensorflow.op.data.AnonymousIterator
134-
*/
135-
public AnonymousIterator anonymousIterator(List<DataType<?>> outputTypes,
136-
List<Shape> outputShapes) {
137-
return AnonymousIterator.create(scope, outputTypes, outputShapes);
138-
}
139-
140154
/**
141155
* Builds an {@link OptionalHasValue} operation
142156
*
@@ -148,20 +162,6 @@ public OptionalHasValue optionalHasValue(Operand<?> optional) {
148162
return OptionalHasValue.create(scope, optional);
149163
}
150164

151-
/**
152-
* Builds an {@link IteratorGetNextSync} operation
153-
*
154-
* @param iterator
155-
* @param outputTypes
156-
* @param outputShapes
157-
* @return a new instance of IteratorGetNextSync
158-
* @see org.tensorflow.op.data.IteratorGetNextSync
159-
*/
160-
public IteratorGetNextSync iteratorGetNextSync(Operand<?> iterator, List<DataType<?>> outputTypes,
161-
List<Shape> outputShapes) {
162-
return IteratorGetNextSync.create(scope, iterator, outputTypes, outputShapes);
163-
}
164-
165165
/**
166166
* Builds an {@link SerializeIterator} operation
167167
*
@@ -186,16 +186,16 @@ public MakeIterator makeIterator(Operand<?> dataset, Operand<?> iterator) {
186186
}
187187

188188
/**
189-
* Builds an {@link IteratorGetNext} operation
189+
* Builds an {@link OptionalGetValue} operation
190190
*
191-
* @param iterator
191+
* @param optional
192192
* @param outputTypes
193193
* @param outputShapes
194-
* @return a new instance of IteratorGetNext
195-
* @see org.tensorflow.op.data.IteratorGetNext
194+
* @return a new instance of OptionalGetValue
195+
* @see org.tensorflow.op.data.OptionalGetValue
196196
*/
197-
public IteratorGetNext iteratorGetNext(Operand<?> iterator, List<DataType<?>> outputTypes,
197+
public OptionalGetValue optionalGetValue(Operand<?> optional, List<DataType<?>> outputTypes,
198198
List<Shape> outputShapes) {
199-
return IteratorGetNext.create(scope, iterator, outputTypes, outputShapes);
199+
return OptionalGetValue.create(scope, optional, outputTypes, outputShapes);
200200
}
201201
}

tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/IoOps.java

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
import org.tensorflow.types.TInt32;
5252
import org.tensorflow.types.TInt64;
5353
import org.tensorflow.types.TString;
54-
import org.tensorflow.util.ndarray.Shape;
54+
import org.tensorflow.util.Shape;
5555

5656
/**
5757
* An API for building {@code io} operations as {@link Op Op}s
@@ -65,6 +65,20 @@ public final class IoOps {
6565
this.scope = scope;
6666
}
6767

68+
/**
69+
* Builds an {@link PriorityQueue} operation
70+
*
71+
* @param componentTypes The type of each component in a value.
72+
* @param shapes The shape of each component in a value. The length of this attr must
73+
* @param options carries optional attributes values
74+
* @return a new instance of PriorityQueue
75+
* @see org.tensorflow.op.io.PriorityQueue
76+
*/
77+
public PriorityQueue priorityQueue(List<DataType<?>> componentTypes, List<Shape> shapes,
78+
PriorityQueue.Options... options) {
79+
return PriorityQueue.create(scope, componentTypes, shapes, options);
80+
}
81+
6882
/**
6983
* Builds an {@link QueueEnqueueMany} operation
7084
*
@@ -155,25 +169,6 @@ public <T> DecodeRaw<T> decodeRaw(Operand<TString> bytes, DataType<T> outType,
155169
return DecodeRaw.create(scope, bytes, outType, options);
156170
}
157171

158-
/**
159-
* Builds an {@link ParseExample} operation
160-
*
161-
* @param serialized A vector containing a batch of binary serialized Example protos.
162-
* @param names A vector containing the names of the serialized protos.
163-
* @param sparseKeys A list of Nsparse string Tensors (scalars).
164-
* @param denseKeys A list of Ndense string Tensors (scalars).
165-
* @param denseDefaults A list of Ndense Tensors (some may be empty).
166-
* @param sparseTypes A list of Nsparse types; the data types of data in each Feature
167-
* @param denseShapes A list of Ndense shapes; the shapes of data in each Feature
168-
* @return a new instance of ParseExample
169-
* @see org.tensorflow.op.io.ParseExample
170-
*/
171-
public ParseExample parseExample(Operand<TString> serialized, Operand<TString> names,
172-
Iterable<Operand<TString>> sparseKeys, Iterable<Operand<TString>> denseKeys,
173-
Iterable<Operand<?>> denseDefaults, List<DataType<?>> sparseTypes, List<Shape> denseShapes) {
174-
return ParseExample.create(scope, serialized, names, sparseKeys, denseKeys, denseDefaults, sparseTypes, denseShapes);
175-
}
176-
177172
/**
178173
* Builds an {@link DecodeBase64} operation
179174
*
@@ -207,6 +202,25 @@ public WholeFileReader wholeFileReader(WholeFileReader.Options... options) {
207202
return WholeFileReader.create(scope, options);
208203
}
209204

205+
/**
206+
* Builds an {@link ParseSingleExample} operation
207+
*
208+
* @param serialized A vector containing a batch of binary serialized Example protos.
209+
* @param denseDefaults A list of Tensors (some may be empty), whose length matches
210+
* @param numSparse The number of sparse features to be parsed from the example. This
211+
* @param sparseKeys A list of `num_sparse` strings.
212+
* @param denseKeys The keys expected in the Examples' features associated with dense
213+
* @param sparseTypes A list of `num_sparse` types; the data types of data in each
214+
* @param denseShapes The shapes of data in each Feature given in dense_keys.
215+
* @return a new instance of ParseSingleExample
216+
* @see org.tensorflow.op.io.ParseSingleExample
217+
*/
218+
public ParseSingleExample parseSingleExample(Operand<TString> serialized,
219+
Iterable<Operand<?>> denseDefaults, Long numSparse, List<String> sparseKeys,
220+
List<String> denseKeys, List<DataType<?>> sparseTypes, List<Shape> denseShapes) {
221+
return ParseSingleExample.create(scope, serialized, denseDefaults, numSparse, sparseKeys, denseKeys, sparseTypes, denseShapes);
222+
}
223+
210224
/**
211225
* Builds an {@link SerializeManySparse} operation
212226
*
@@ -409,25 +423,6 @@ public EncodeBase64 encodeBase64(Operand<TString> input, EncodeBase64.Options...
409423
return EncodeBase64.create(scope, input, options);
410424
}
411425

412-
/**
413-
* Builds an {@link ParseSingleExample} operation
414-
*
415-
* @param serialized A vector containing a batch of binary serialized Example protos.
416-
* @param denseDefaults A list of Tensors (some may be empty), whose length matches
417-
* @param numSparse The number of sparse features to be parsed from the example. This
418-
* @param sparseKeys A list of `num_sparse` strings.
419-
* @param denseKeys The keys expected in the Examples' features associated with dense
420-
* @param sparseTypes A list of `num_sparse` types; the data types of data in each
421-
* @param denseShapes The shapes of data in each Feature given in dense_keys.
422-
* @return a new instance of ParseSingleExample
423-
* @see org.tensorflow.op.io.ParseSingleExample
424-
*/
425-
public ParseSingleExample parseSingleExample(Operand<TString> serialized,
426-
Iterable<Operand<?>> denseDefaults, Long numSparse, List<String> sparseKeys,
427-
List<String> denseKeys, List<DataType<?>> sparseTypes, List<Shape> denseShapes) {
428-
return ParseSingleExample.create(scope, serialized, denseDefaults, numSparse, sparseKeys, denseKeys, sparseTypes, denseShapes);
429-
}
430-
431426
/**
432427
* Builds an {@link SerializeSparse} operation
433428
*
@@ -494,6 +489,25 @@ public ReaderNumWorkUnitsCompleted readerNumWorkUnitsCompleted(Operand<?> reader
494489
return ReaderNumWorkUnitsCompleted.create(scope, readerHandle);
495490
}
496491

492+
/**
493+
* Builds an {@link ParseExample} operation
494+
*
495+
* @param serialized A vector containing a batch of binary serialized Example protos.
496+
* @param names A vector containing the names of the serialized protos.
497+
* @param sparseKeys A list of Nsparse string Tensors (scalars).
498+
* @param denseKeys A list of Ndense string Tensors (scalars).
499+
* @param denseDefaults A list of Ndense Tensors (some may be empty).
500+
* @param sparseTypes A list of Nsparse types; the data types of data in each Feature
501+
* @param denseShapes A list of Ndense shapes; the shapes of data in each Feature
502+
* @return a new instance of ParseExample
503+
* @see org.tensorflow.op.io.ParseExample
504+
*/
505+
public ParseExample parseExample(Operand<TString> serialized, Operand<TString> names,
506+
Iterable<Operand<TString>> sparseKeys, Iterable<Operand<TString>> denseKeys,
507+
Iterable<Operand<?>> denseDefaults, List<DataType<?>> sparseTypes, List<Shape> denseShapes) {
508+
return ParseExample.create(scope, serialized, names, sparseKeys, denseKeys, denseDefaults, sparseTypes, denseShapes);
509+
}
510+
497511
/**
498512
* Builds an {@link ReaderRead} operation
499513
*
@@ -545,20 +559,6 @@ public <T> SerializeTensor serializeTensor(Operand<T> tensor) {
545559
return SerializeTensor.create(scope, tensor);
546560
}
547561

548-
/**
549-
* Builds an {@link PriorityQueue} operation
550-
*
551-
* @param componentTypes The type of each component in a value.
552-
* @param shapes The shape of each component in a value. The length of this attr must
553-
* @param options carries optional attributes values
554-
* @return a new instance of PriorityQueue
555-
* @see org.tensorflow.op.io.PriorityQueue
556-
*/
557-
public PriorityQueue priorityQueue(List<DataType<?>> componentTypes, List<Shape> shapes,
558-
PriorityQueue.Options... options) {
559-
return PriorityQueue.create(scope, componentTypes, shapes, options);
560-
}
561-
562562
/**
563563
* Builds an {@link QueueIsClosed} operation
564564
*

tensorflow-core/tensorflow-core-api/src/gen/annotations/org/tensorflow/op/MathOps.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
import org.tensorflow.types.TInt32;
108108
import org.tensorflow.types.TInt64;
109109
import org.tensorflow.types.family.TNumber;
110-
import org.tensorflow.util.ndarray.Shape;
110+
import org.tensorflow.util.Shape;
111111

112112
/**
113113
* An API for building {@code math} operations as {@link Op Op}s
@@ -558,18 +558,6 @@ public <T> RealDiv<T> realDiv(Operand<T> x, Operand<T> y) {
558558
return RealDiv.create(scope, x, y);
559559
}
560560

561-
/**
562-
* Builds an {@link AccumulateN} operation
563-
*
564-
* @param inputs A list of `Tensor` objects, each with same shape and type.
565-
* @param shape Shape of elements of `inputs`.
566-
* @return a new instance of AccumulateN
567-
* @see org.tensorflow.op.math.AccumulateN
568-
*/
569-
public <T> AccumulateN<T> accumulateN(Iterable<Operand<T>> inputs, Shape shape) {
570-
return AccumulateN.create(scope, inputs, shape);
571-
}
572-
573561
/**
574562
* Builds an {@link Digamma} operation
575563
*
@@ -1307,6 +1295,18 @@ public <U extends TNumber, T> Real<U> real(Operand<T> input, DataType<U> Tout) {
13071295
return Real.create(scope, input, Tout);
13081296
}
13091297

1298+
/**
1299+
* Builds an {@link AccumulateN} operation
1300+
*
1301+
* @param inputs A list of `Tensor` objects, each with same shape and type.
1302+
* @param shape Shape of elements of `inputs`.
1303+
* @return a new instance of AccumulateN
1304+
* @see org.tensorflow.op.math.AccumulateN
1305+
*/
1306+
public <T> AccumulateN<T> accumulateN(Iterable<Operand<T>> inputs, Shape shape) {
1307+
return AccumulateN.create(scope, inputs, shape);
1308+
}
1309+
13101310
/**
13111311
* Builds an {@link QuantizedAdd} operation
13121312
*

0 commit comments

Comments
 (0)