Skip to content

Commit cecf71d

Browse files
committed
Formatting
Signed-off-by: Ryan Nett <[email protected]>
1 parent 99a3403 commit cecf71d

21 files changed

+407
-372
lines changed

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

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
/*
2-
Copyright 2021 The TensorFlow Authors. All Rights Reserved.
1+
/* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
32
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
76
8-
http://www.apache.org/licenses/LICENSE-2.0
7+
http://www.apache.org/licenses/LICENSE-2.0
98
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
==============================================================================
16-
*/
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
=======================================================================
15+
*/
1716
package org.tensorflow;
1817

1918
import java.util.LinkedHashMap;

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
/*
2-
* Copyright 2020 The TensorFlow Authors. All rights reserved.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
1+
/* Copyright 2020-2021 The TensorFlow Authors. All Rights Reserved.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
=======================================================================
1515
*/
1616
package org.tensorflow;
1717

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
1+
/* Copyright 2019-2021 The TensorFlow Authors. All Rights Reserved.
22
3-
Licensed under the Apache License, Version 2.0 (the "License");
4-
you may not use this file except in compliance with the License.
5-
You may obtain a copy of the License at
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
66
7-
http://www.apache.org/licenses/LICENSE-2.0
8-
9-
Unless required by applicable law or agreed to in writing, software
10-
distributed under the License is distributed on an "AS IS" BASIS,
11-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
See the License for the specific language governing permissions and
13-
limitations under the License.
14-
==============================================================================*/
7+
http://www.apache.org/licenses/LICENSE-2.0
158
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
=======================================================================
15+
*/
1616
package org.tensorflow;
1717

1818
import static org.tensorflow.internal.c_api.global.tensorflow.TFE_Execute;

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ enum Types {
3838
OperationBuilder opBuilder(String type, String name);
3939

4040
/**
41-
* Attach the function and its dependencies to this execution environment, allowing it to be called.
41+
* Attach the function and its dependencies to this execution environment, allowing it to be
42+
* called.
4243
*
43-
* Done automatically in the {@link org.tensorflow.op.Ops#call(ConcreteFunction, java.util.Map)} ops.
44+
* <p>Done automatically in the {@link org.tensorflow.op.Ops#call(ConcreteFunction,
45+
* java.util.Map)} ops.
4446
*/
4547
void attachFunction(ConcreteFunction function);
4648

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

Lines changed: 61 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
1+
/* Copyright 2019-2021 The TensorFlow Authors. All Rights Reserved.
22
3-
Licensed under the Apache License, Version 2.0 (the "License");
4-
you may not use this file except in compliance with the License.
5-
You may obtain a copy of the License at
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
66
7-
http://www.apache.org/licenses/LICENSE-2.0
8-
9-
Unless required by applicable law or agreed to in writing, software
10-
distributed under the License is distributed on an "AS IS" BASIS,
11-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
See the License for the specific language governing permissions and
13-
limitations under the License.
14-
==============================================================================*/
7+
http://www.apache.org/licenses/LICENSE-2.0
158
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
=======================================================================
15+
*/
1616
package org.tensorflow;
1717

1818
import static org.tensorflow.internal.c_api.global.tensorflow.TF_AddControlInput;
@@ -63,9 +63,7 @@
6363
import org.tensorflow.proto.framework.DataType;
6464
import org.tensorflow.proto.framework.NameAttrList;
6565

66-
/**
67-
* An {@link OperationBuilder} for adding {@link GraphOperation}s to a {@link Graph}.
68-
*/
66+
/** An {@link OperationBuilder} for adding {@link GraphOperation}s to a {@link Graph}. */
6967
public final class GraphOperationBuilder implements OperationBuilder {
7068

7169
GraphOperationBuilder(Graph graph, String type, String name) {
@@ -103,7 +101,8 @@ public GraphOperationBuilder addControlInput(Operation control) {
103101
}
104102

105103
if (control.env() != graph) {
106-
throw new IllegalArgumentException("Control input " + control + " was from a different graph, can't use.");
104+
throw new IllegalArgumentException(
105+
"Control input " + control + " was from a different graph, can't use.");
107106
}
108107

109108
Graph.Reference r = graph.ref();
@@ -369,9 +368,12 @@ public OperationBuilder setAttr(String name, ConcreteFunction[] value) {
369368
}
370369

371370
try (Reference r = graph.ref()) {
372-
setAttrFunctionList(unsafeNativeHandle, name, Arrays.stream(value)
373-
.map(ConcreteFunction::getNativeFunctionName)
374-
.collect(Collectors.toList()));
371+
setAttrFunctionList(
372+
unsafeNativeHandle,
373+
name,
374+
Arrays.stream(value)
375+
.map(ConcreteFunction::getNativeFunctionName)
376+
.collect(Collectors.toList()));
375377
}
376378
return this;
377379
}
@@ -426,11 +428,16 @@ private static void addInput(TF_OperationDescription handle, TF_Operation opHand
426428
}
427429
}
428430

429-
private static void addInputList(TF_OperationDescription handle, TF_Operation[] opHandles, int[] indices) {
431+
private static void addInputList(
432+
TF_OperationDescription handle, TF_Operation[] opHandles, int[] indices) {
430433
requireHandle(handle);
431434
if (indices.length != opHandles.length) {
432-
throw new IllegalArgumentException("mismatch in number of Operations ("
433-
+ opHandles.length + ") and output indices (" + indices.length + ") provided");
435+
throw new IllegalArgumentException(
436+
"mismatch in number of Operations ("
437+
+ opHandles.length
438+
+ ") and output indices ("
439+
+ indices.length
440+
+ ") provided");
434441
}
435442

436443
try (PointerScope scope = new PointerScope()) {
@@ -444,8 +451,8 @@ private static void addInputList(TF_OperationDescription handle, TF_Operation[]
444451

445452
private static void addControlInput(TF_OperationDescription handle, TF_Operation opHandle) {
446453
if (opHandle == null || opHandle.isNull()) {
447-
throw new IllegalStateException("control input is not valid, "
448-
+ "perhaps the Graph containing it has been closed()?");
454+
throw new IllegalStateException(
455+
"control input is not valid, " + "perhaps the Graph containing it has been closed()?");
449456
}
450457
requireHandle(handle);
451458
TF_AddControlInput(handle, opHandle);
@@ -491,7 +498,8 @@ private static void setAttrBool(TF_OperationDescription handle, String name, boo
491498
TF_SetAttrBool(handle, name, (byte) (value ? 1 : 0));
492499
}
493500

494-
private static void setAttrBoolList(TF_OperationDescription handle, String name, boolean[] value) {
501+
private static void setAttrBoolList(
502+
TF_OperationDescription handle, String name, boolean[] value) {
495503
requireHandle(handle);
496504
try (PointerScope scope = new PointerScope()) {
497505
TF_SetAttrBoolList(handle, name, new BytePointer(new BooleanPointer(value)), value.length);
@@ -508,7 +516,8 @@ private static void setAttrTypeList(TF_OperationDescription handle, String name,
508516
TF_SetAttrTypeList(handle, name, type, type.length);
509517
}
510518

511-
private static void setAttrTensor(TF_OperationDescription handle, String name, TF_Tensor tensorHandle) {
519+
private static void setAttrTensor(
520+
TF_OperationDescription handle, String name, TF_Tensor tensorHandle) {
512521
requireHandle(handle);
513522
requireTensor(tensorHandle);
514523

@@ -519,7 +528,8 @@ private static void setAttrTensor(TF_OperationDescription handle, String name, T
519528
}
520529
}
521530

522-
private static void setAttrTensorList(TF_OperationDescription handle, String name, TF_Tensor[] tensorHandles) {
531+
private static void setAttrTensorList(
532+
TF_OperationDescription handle, String name, TF_Tensor[] tensorHandles) {
523533
requireHandle(handle);
524534

525535
try (PointerScope scope = new PointerScope()) {
@@ -530,20 +540,23 @@ private static void setAttrTensorList(TF_OperationDescription handle, String nam
530540
}
531541

532542
TF_Status status = TF_Status.newStatus();
533-
TF_SetAttrTensorList(handle, new BytePointer(name), tensors.position(0), tensorHandles.length, status);
543+
TF_SetAttrTensorList(
544+
handle, new BytePointer(name), tensors.position(0), tensorHandles.length, status);
534545
status.throwExceptionIfNotOK();
535546
}
536547
}
537548

538-
private static void setAttrShape(TF_OperationDescription handle, String name, long[] shape, int numDims) {
549+
private static void setAttrShape(
550+
TF_OperationDescription handle, String name, long[] shape, int numDims) {
539551
requireHandle(handle);
540552

541553
// num_dims and env->GetArrayLength(shape) are assumed to be consistent.
542554
// i.e., either num_dims < 0 or num_dims == env->GetArrayLength(shape).
543555
TF_SetAttrShape(handle, name, shape, numDims);
544556
}
545557

546-
private static void setAttrShapeList(TF_OperationDescription handle, String name, long[] shapes, int[] numDims) {
558+
private static void setAttrShapeList(
559+
TF_OperationDescription handle, String name, long[] shapes, int[] numDims) {
547560
requireHandle(handle);
548561

549562
try (PointerScope scope = new PointerScope()) {
@@ -553,11 +566,13 @@ private static void setAttrShapeList(TF_OperationDescription handle, String name
553566
shapesPointers.put(i, shapesPointer);
554567
shapesPointer.position(shapesPointer.position() + numDims[i] * 8);
555568
}
556-
TF_SetAttrShapeList(handle, new BytePointer(name), shapesPointers, new IntPointer(numDims), numDims.length);
569+
TF_SetAttrShapeList(
570+
handle, new BytePointer(name), shapesPointers, new IntPointer(numDims), numDims.length);
557571
}
558572
}
559573

560-
private static void setAttrStringList(TF_OperationDescription handle, String name, byte[][] value) {
574+
private static void setAttrStringList(
575+
TF_OperationDescription handle, String name, byte[][] value) {
561576
requireHandle(handle);
562577

563578
try (PointerScope scope = new PointerScope()) {
@@ -572,23 +587,29 @@ private static void setAttrStringList(TF_OperationDescription handle, String nam
572587
}
573588
}
574589

575-
private static void setAttrFunctionName(TF_OperationDescription opHandle, String attrName, String functionName) {
590+
private static void setAttrFunctionName(
591+
TF_OperationDescription opHandle, String attrName, String functionName) {
576592
requireHandle(opHandle);
577593
try (PointerScope scope = new PointerScope()) {
578594
TF_SetAttrFuncName(opHandle, attrName, functionName, functionName.length());
579595
}
580596
}
581597

582-
private static void setAttrFunctionList(TF_OperationDescription opHandle, String attrName,
583-
List<String> functionNames) {
598+
private static void setAttrFunctionList(
599+
TF_OperationDescription opHandle, String attrName, List<String> functionNames) {
584600
requireHandle(opHandle);
585601
try (PointerScope scope = new PointerScope()) {
586602
TF_Status status = TF_Status.newStatus();
587-
AttrValue value = AttrValue.newBuilder().setList(ListValue.newBuilder().addAllFunc(
588-
functionNames.stream()
589-
.map(x -> NameAttrList.newBuilder().setName(x).build())
590-
.collect(Collectors.toList())
591-
).build()).build();
603+
AttrValue value =
604+
AttrValue.newBuilder()
605+
.setList(
606+
ListValue.newBuilder()
607+
.addAllFunc(
608+
functionNames.stream()
609+
.map(x -> NameAttrList.newBuilder().setName(x).build())
610+
.collect(Collectors.toList()))
611+
.build())
612+
.build();
592613
byte[] bytes = value.toByteArray();
593614
TF_SetAttrValueProto(opHandle, attrName, new BytePointer(bytes), bytes.length, status);
594615
status.throwExceptionIfNotOK();

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

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
/*
2-
Copyright 2021 The TensorFlow Authors. All Rights Reserved.
3-
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
==============================================================================
16-
*/
1+
/* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
=======================================================================
15+
*/
1716
package org.tensorflow;
1817

1918
import static org.tensorflow.internal.c_api.global.tensorflow.TF_FunctionName;

0 commit comments

Comments
 (0)