Package ai.djl.nn
Class Blocks
- java.lang.Object
-
- ai.djl.nn.Blocks
-
public final class Blocks extends java.lang.ObjectUtility class that provides some useful blocks.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static NDArraybatchFlatten(NDArray array)static NDArraybatchFlatten(NDArray array, long size)static BlockbatchFlattenBlock()Creates aBlockwhose forward function applies thebatchFlattenmethod.static BlockbatchFlattenBlock(long size)Creates aBlockwhose forward function applies thebatchFlattenmethod.static BlockidentityBlock()Creates aLambdaBlockthat performs the identity function.
-
-
-
Method Detail
-
batchFlattenBlock
public static Block batchFlattenBlock()
Creates aBlockwhose forward function applies thebatchFlattenmethod.- Returns:
- a
Blockwhose forward function applies thebatchFlattenmethod
-
batchFlattenBlock
public static Block batchFlattenBlock(long size)
Creates aBlockwhose forward function applies thebatchFlattenmethod. The size of input to the block returned must be batch_size * size.- Parameters:
size- the expected size of each input- Returns:
- a
Blockwhose forward function applies thebatchFlattenmethod
-
identityBlock
public static Block identityBlock()
Creates aLambdaBlockthat performs the identity function.- Returns:
- an identity
Block
-
-