Replace numpy methods with Tensorly equivalent #59
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test TensorLy | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
BACKEND: ['numpy', 'pytorch'] | |
python-version: ['3.12'] | |
include: | |
- BACKEND: 'numpy' | |
python-version: '3.8' | |
- BACKEND: 'numpy' | |
python-version: '3.9' | |
TENSORLY_TENALG_BACKEND: ['einsum'] | |
- BACKEND: 'jax' | |
python-version: '3.12' | |
TENSORLY_TENALG_BACKEND: ['einsum'] | |
- BACKEND: 'tensorflow' | |
python-version: '3.12' | |
TENSORLY_TENALG_BACKEND: ['einsum'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
cache-dependency-path: | | |
requirements.txt | |
- name: Install dependencies and backend ${{matrix.BACKEND}} | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r requirements.txt | |
python -m pip install -r doc/requirements_doc.txt | |
echo "Installing dependencies for BACKEND=${{matrix.BACKEND}}" | |
if [[ "${{matrix.BACKEND}}" == "numpy" ]]; then | |
echo "Installing sparse"; | |
pip install sparse; | |
elif [[ "${{matrix.BACKEND}}" == "pytorch" ]]; then | |
echo "Installing PyTorch"; | |
pip install torch torchvision; | |
elif [[ "${{matrix.BACKEND}}" == "tensorflow" ]]; then | |
echo "Installing TensorFlow"; | |
pip install tensorflow; | |
elif [[ "${{matrix.BACKEND}}" == "jax" ]]; then | |
echo "Installing JAX"; | |
pip install jax jaxlib; | |
fi | |
- name: Install package | |
run: | | |
python -m pip install -e . | |
- name: Test with backend ${{matrix.BACKEND}} pytest and coverage | |
run: | | |
TENSORLY_BACKEND=${{matrix.BACKEND}} pytest -vv --cov tensorly --cov-report xml --durations=10 tensorly | |
- name: Check coverage with CodeCov | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./coverage.xml | |
verbose: true |