Skip to content

Commit 55698f5

Browse files
committed
Don't warn about autoboxing.
1 parent c4cdb16 commit 55698f5

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import tensorflow as tf
2+
3+
# Create an override model to classify pictures
4+
5+
class SequentialModel(tf.keras.Model):
6+
def __init__(self, **kwargs):
7+
super(SequentialModel, self).__init__(**kwargs)
8+
9+
self.flatten = tf.keras.layers.Flatten(input_shape=(28, 28))
10+
11+
# Add a lot of small layers
12+
num_layers = 100
13+
self.my_layers = [tf.keras.layers.Dense(64, activation="relu")
14+
for n in range(num_layers)]
15+
16+
self.dropout = tf.keras.layers.Dropout(0.2)
17+
self.dense_2 = tf.keras.layers.Dense(10)
18+
19+
def call(self, x):
20+
x = self.flatten(x)
21+
22+
for layer in self.my_layers:
23+
x = layer(x)
24+
25+
x = self.dropout(x)
26+
x = self.dense_2(x)
27+
28+
return x
29+
30+
if __name__ == '__main__':
31+
input_data = tf.random.uniform([20, 28, 28])
32+
print("Input:")
33+
print(type(input_data))
34+
print(input_data)
35+
36+
model = SequentialModel()
37+
result = model(input_data)
38+
39+
print("Output:")
40+
print(type(input_data))
41+
print(result)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tensorflow==2.9.3

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@
156156
<arg>-err:-super</arg>
157157
<arg>-err:-discouraged</arg>
158158
<arg>-err:-emptyBlock</arg>
159+
<arg>-err:-boxing</arg>
159160
</compilerArgs>
160161
</configuration>
161162
</plugin>

0 commit comments

Comments
 (0)