An Implementation for ConvLSTM in Apple's Array Framework, MLX
A Convolutional LSTM recurrent layer.
_conv_lstm_cell
This nn.Module computes the hidden and cell state for a time-step, expressed as:
$i_t = \sigma (W_{xi} \ast X_t + W_{hi} \ast H_{t-1} + W_{ci} \odot C_{t-1} + b_i)$
$f_t = \sigma (W_{xf} \odot X_t \ast H_{t-1} + W_{cf} \odot C_{t-1} + b_f)$
$C_t = f_t \odot X_t + i_t \odot tanh(W_{xc} \ast X_{t} + W_{hc} \ast H_{t-1} + b_c)$
$ o_t = \sigma(W_{xo} \ast X_t + W_{ho} \ast H_{t-1} + W_{co} \odot C_t + b_o )$
$H_t = o_t \odot tanh(C_t)$ \
Where $\sigma$ and $\odot$ represent the hyperbolic sigmoid function and Hadamard product respectively.
The expected input for this layer has shape NHWC or HWC where:
Nis the optional batch dimensionHis the input's spatial height dimensionWis the input's spatial width dimensionCis the input's channel dimension
And returns a Tuple of the hidden state, $H_t$, and the cell state, $C_t$, each with shape NHWO.
Args:
in_channels (int): The number of input channels, C.
out_channels (int): The number of output channels, O.
kernel_size (int): The size of the convolution filters, must be odd to keep spatial dimensions with padding. Default: 5.
stride (Union[int, tuple] : The stride of the convolution.
padding (Union[int, tuple] : Padding to add to the input for convolution.
dilation (Union[int, tuple] : Dilation of the convolution.
bias (bool): Whether the convolutional calculation should use biases or not. Default: True.
ConvLSTM
Unrolls a _conv_lstm_cell sequentially over time-steps.
The expected input for this layer has shape NLHWC or LHWC where:
Nis the optional batch dimensionLis the length of the sequenceHis the input's spatial height dimensionWis the input's spatial width dimensionCis the input's channel dimension
Args:
in_channels (int): The number of input channels, C.
out_channels (int): The number of output channels, O.
kernel_size (int): The size of the convolution filters, must be odd to keep spatial dimensions with padding. Default: 5.
bias (bool): Whether the convolutional calculation should use biases or not. Default: True.
The following features are yet to be implemented from initial release:
- Bi-directionality - allows the conv-lstm to unroll both forwards and backwards across the sequence
- Allow for stride customization
- Allow for customizable padding along with modes 'same' and 'valid'
Release files for convlstm-mlx 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| convlstm_mlx-0.1.1.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| convlstm_mlx-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.2 kB
Release files / convlstm_mlx-0.1.1.tar.gz
| Download URL | convlstm_mlx-0.1.1.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f5991bc12b86af008791b2a40e9cfb9bd703d8f28d2212e59c406a2ee673e79
|
|
BLAKE2b-256 checksum How to use checksums |
63fb8cf19ead053fa3036eb722d280b87203d8a049d3fd04d2cfaaae56ea24c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2024.
Transparency logRelease files / convlstm_mlx-0.1.1-py3-none-any.whl
| Download URL | convlstm_mlx-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ebc2fa9444df0253134bedcb1056ce83989ef490afbec802a10ee0e469b32297
|
|
BLAKE2b-256 checksum How to use checksums |
02d9d1b7c99457c6b1ebd058aa1ad5f47a484bd915f0d16c8fad08009a11787c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2024.
Transparency log