Skip to content

Commit 13bd6c2

Browse files
authored
add sample code for summary (#3571) (#3573)
1 parent 34f027d commit 13bd6c2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/api/paddle/summary_cn.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,17 @@ summary
7878
# ---------------------------------------------------------------------------
7979
# {'total_params': 61610, 'trainable_params': 61610}
8080
81+
# multi input demo
82+
class LeNetMultiInput(LeNet):
83+
def forward(self, inputs, y):
84+
x = self.features(inputs)
85+
if self.num_classes > 0:
86+
x = paddle.flatten(x, 1)
87+
x = self.fc(x + y)
88+
return x
89+
90+
lenet_multi_input = LeNetMultiInput()
91+
params_info = paddle.summary(lenet_multi_input, [(1, 1, 28, 28), (1, 400)],
92+
['float32', 'float32'])
93+
print(params_info)
94+

0 commit comments

Comments
 (0)