.FastAI
Encoding
abstract type
defined in module
FastAI
abstract type Encoding
Transformation of
Block
s. Can encode some
Block
s ([
encode
]), and optionally decode them [
decode
]
encode(::E, ::Context, block::Block, data)
encodes
block
of
data
. The default is to do nothing. This should be overloaded for an encoding
E
, concrete
Block
types and possibly a context.
decode(::E, ::Context, block::Block, data)
decodes
block
of
data
. This should correspond as closely as possible to the inverse of
encode(::E, ...)
. The default is to do nothing, as not all encodings can be reversed. This should be overloaded for an encoding
E
, concrete
Block
types and possibly a context.
encodedblock(::E, block::Block) -> block'
returns the block that is obtained by encoding
block
with encoding
E
. This needs to be constant for an instance of
E
, so it cannot depend on the sample or on randomness. The default is to return
nothing
, meaning the same block is returned and not changed. Encodings that return the same block but change the data (e.g.
ProjectiveTransforms
) should return
block
.
decodedblock(::E, block::Block) -> block'
returns the block that is obtained by decoding
block
with encoding
E
. This needs to be constant for an instance of
E
, so it cannot depend on the sample or on randomness. The default is to return
nothing
, meaning the same block is returned and not changed.
encode!(buf, ::E, ::Context, block::Block, data)
encodes
data
inplace.
decode!(buf, ::E, ::Context, block::Block, data)
decodes
data
inplace.
The following pages link back here:
blocks/many.jl , datablock/encoding.jl , datablock/wrappers.jl , encodings/onehot.jl , encodings/only.jl