test(network): add test case to ensure deprecation warning
import torch
import numpy as np
import torch.nn as nn
+import pytest
from neurodiffeq.networks import FCNN
from neurodiffeq.networks import Resnet
from neurodiffeq.networks import MonomialNN
@@ -27,6 +28,23 @@ def test_fcnn():
n_features_out = np.random.randint(1, 5)
n_hidden_units = np.random.randint(30, 60)
n_hidden_layers = np.random.randint(0, 4)
+ hidden_units = [np.random.randint(1, 10) for _ in range(np.random.randint(2, 4))]
+
+ with pytest.deprecated_call():
+ _test_shape(
+ n_samples, n_features_in, n_features_out, FCNN,
+ n_input_units=n_features_in,
+ n_output_units=n_features_out,
+ n_hidden_units=n_hidden_units,
+ )
+ with pytest.deprecated_call():
+ _test_shape(
+ n_samples, n_features_in, n_features_out, FCNN,
+ n_input_units=n_features_in,
+ n_output_units=n_features_out,
+ n_hidden_layers=n_hidden_layers,
+ )
+ with pytest.deprecated_call():
_test_shape(
n_samples, n_features_in, n_features_out, FCNN,
n_input_units=n_features_in,
@@ -34,6 +52,22 @@ def test_fcnn():
n_hidden_units=n_hidden_units,
n_hidden_layers=n_hidden_layers,
)
+ with pytest.deprecated_call():
+ _test_shape(
+ n_samples, n_features_in, n_features_out, FCNN,
+ n_input_units=n_features_in,
+ n_output_units=n_features_out,
+ n_hidden_units=n_hidden_units,
+ n_hidden_layers=n_hidden_layers,
+ hidden_units=hidden_units
+ )
+
+ _test_shape(
+ n_samples, n_features_in, n_features_out, FCNN,
+ n_input_units=n_features_in,
+ n_output_units=n_features_out,
+ hidden_units=hidden_units
+ )
def test_resnet():
