deepjavalibrary / djl

An Engine-Agnostic Deep Learning Framework in Java
https://djl.ai
Apache License 2.0
4.13k stars 656 forks source link

How to print model's topology and each block's input/output information (如何打印model 的网络结构) #89

Closed yanchaoguo closed 2 years ago

yanchaoguo commented 4 years ago

或者获取每层网络的类型和大小 、输入和输出维度相关信息

frankfliu commented 4 years ago

@yanchaoguo We don't support this feature today. We had some prototype, and not mature enough to publish it.

frankfliu commented 4 years ago

You can manually get those information using Block API:

  1. Each block has inputShape and inputNames variable: https://github.com/awslabs/djl/blob/master/api/src/main/java/ai/djl/nn/AbstractBlock.java#L73-L76
  2. You call Block.getOutputShapes() to get output information: https://github.com/awslabs/djl/blob/master/api/src/main/java/ai/djl/nn/Block.java#L228
stu1130 commented 4 years ago

I think I can improve this when I refactor the initializer

siddvenk commented 2 years ago

We have this now since DJL 0.18.0 https://github.com/deepjavalibrary/djl/pull/1720