Skip to content

Question on Chap. 5.1: AbstractBlock.getOutputShapes #752

Answered by zachgk
hmf asked this question in Q&A
Discussion options

You must be logged in to vote

The getOutputShapes should return what the output NDArray shapes would be, for a given input into your custom Block. It uses an array of shapes as an input and output because blocks use NDLists, not NDArrays. So, each element in the array of shapes is the shape for a different NDArray in the NDList. If you only pass a singleton NDList (as is quite common), you would have arrays containing only one shape.

The getOutputShapes is about the block's forward method. Knowing what shapes the forward will input or output is used for both printing blocks and initialization. So, initializeChildBlocks might be using this information to help determine the inputs for various child blocks.

Yeah, we adde…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@hmf
Comment options

Answer selected by hmf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants