Skip to content

Commit

Permalink
Xfail pytorch tests with conv2d/maxpooling + float16 + CPU
Browse files Browse the repository at this point in the history
  • Loading branch information
nhuet committed Dec 15, 2023
1 parent f670071 commit 5c79b67
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
4 changes: 4 additions & 0 deletions tests/test_backward_conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@


def test_Decomon_conv_box(data_format, padding, use_bias, mode, floatx, decimal, helpers):
# xfail unavailable combinations
if floatx == 16 and keras_config.backend() == "torch":
pytest.xfail("Pytorch does not implement conv2d for float16")

if data_format == "channels_first" and not helpers.in_GPU_mode():
pytest.skip("data format 'channels first' is possible only in GPU mode")

Expand Down
8 changes: 8 additions & 0 deletions tests/test_conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@


def test_Decomon_conv_box(data_format, mode, dc_decomp, floatx, decimal, helpers):
# xfail unavailable combinations
if floatx == 16 and keras_config.backend() == "torch":
pytest.xfail("Pytorch does not implement conv2d for float16")

if data_format == "channels_first" and not helpers.in_GPU_mode():
pytest.skip("data format 'channels first' is possible only in GPU mode")

Expand Down Expand Up @@ -63,6 +67,10 @@ def test_Decomon_conv_box(data_format, mode, dc_decomp, floatx, decimal, helpers


def test_Decomon_conv_to_decomon_box(shared, floatx, dc_decomp, helpers):
# xfail unavailable combinations
if floatx == 16 and keras_config.backend() == "torch":
pytest.xfail("Pytorch does not implement conv2d for float16")

data_format = "channels_last"
odd, m_0, m_1 = 0, 0, 1
dc_decomp = True
Expand Down
5 changes: 5 additions & 0 deletions tests/test_pooling.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import keras.config as keras_config
import pytest
from keras.layers import MaxPooling2D

from decomon.layers.maxpooling import DecomonMaxPooling2D


def test_MaxPooling2D_box(mode, floatx, decimal, helpers):
# xfail unavailable combinations
# if floatx == 16 and keras_config.backend() == "torch":
# pytest.xfail("Pytorch does not implement maxpooling for float16")

odd, m_0, m_1 = 0, 0, 1
data_format = "channels_last"
dc_decomp = True
Expand Down
11 changes: 9 additions & 2 deletions tests/test_utils_conv.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Test unit for decomon with Dense layers


import keras.config
import keras.ops as K
import numpy as np
import pytest
Expand All @@ -13,6 +12,10 @@


def test_toeplitz_from_Keras(channels, filter_size, strides, flatten, data_format, padding, floatx, decimal, helpers):
# xfail unavailable combinations
if floatx == 16 and keras.config.backend() == "torch":
pytest.xfail("Pytorch does not implement conv2d for float16")

# filter_size, strides, flatten,
if floatx == 16:
decimal = 0
Expand Down Expand Up @@ -67,6 +70,10 @@ def test_toeplitz_from_Keras(channels, filter_size, strides, flatten, data_forma
def test_toeplitz_from_Decomon(
floatx, decimal, mode, channels, filter_size, strides, flatten, data_format, padding, helpers
):
# xfail unavailable combinations
if floatx == 16 and keras.config.backend() == "torch":
pytest.xfail("Pytorch does not implement conv2d for float16")

if data_format == "channels_first" and not helpers.in_GPU_mode():
pytest.skip("data format 'channels first' is possible only in GPU mode")

Expand Down

0 comments on commit 5c79b67

Please sign in to comment.