Package ai.djl.fasttext
Class FtAbstractBlock
java.lang.Object
ai.djl.nn.AbstractBaseBlock
ai.djl.nn.AbstractSymbolBlock
ai.djl.fasttext.FtAbstractBlock
- All Implemented Interfaces:
ai.djl.nn.Block,ai.djl.nn.SymbolBlock,AutoCloseable
- Direct Known Subclasses:
FtTextClassification,FtWordEmbeddingBlock
public abstract class FtAbstractBlock
extends ai.djl.nn.AbstractSymbolBlock
implements AutoCloseable
A parent class containing shared behavior for
SymbolBlocks based on fasttext
models.-
Field Summary
FieldsFields inherited from class ai.djl.nn.AbstractBaseBlock
inputNames, inputShapes, outputDataTypes, version -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()float[]Embeds a word using fasttext.ai.djl.nn.ParameterListReturns the fasttext model file for the block.Methods inherited from class ai.djl.nn.AbstractSymbolBlock
getChildren, getOutputShapesMethods inherited from class ai.djl.nn.AbstractBaseBlock
beforeInitialize, cast, clear, describeInput, forward, forward, forwardInternal, forwardInternal, getInputShapes, getOutputDataTypes, getParameters, initialize, initializeChildBlocks, isInitialized, loadMetadata, loadParameters, prepare, readInputShapes, saveInputShapes, saveMetadata, saveParameters, setInitializer, setInitializer, setInitializer, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ai.djl.nn.Block
cast, clear, describeInput, forward, forward, forward, freezeParameters, freezeParameters, getInputShapes, getOutputDataTypes, getOutputShapes, getParameters, initialize, isInitialized, loadParameters, saveParameters, setInitializer, setInitializer, setInitializerMethods inherited from interface ai.djl.nn.SymbolBlock
describeOutput, removeLastBlock
-
Field Details
-
fta
-
modelFile
-
-
Constructor Details
-
FtAbstractBlock
Constructs aFtAbstractBlock.- Parameters:
fta- theFtWrappercontaining the "fasttext model"
-
-
Method Details
-
getModelFile
Returns the fasttext model file for the block.- Returns:
- the fasttext model file for the block
-
embedWord
Embeds a word using fasttext.- Parameters:
word- the word to embed- Returns:
- the embedding
- See Also:
-
WordEmbedding
-
getDirectParameters
public ai.djl.nn.ParameterList getDirectParameters()- Specified by:
getDirectParametersin interfaceai.djl.nn.Block
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-