# Path: rigl/experimental/jax/pruning/masked.py
# def masked(module, mask):
#   """Convenience function for masking a FLAX module with MaskedModule."""
#   return MaskedModule.partial(wrapped_module=module, mask=mask)
# 
# Path: rigl/experimental/jax/pruning/symmetry.py
# def count_permutations_mask_layer(
#     mask_layer,
#     next_mask_layer = None,
#     parameter_key = 'kernel'):
# def count_permutations_mask(mask):
# def get_mask_stats(mask):


import functools
import math
import operator
import flax
import jax
import jax.numpy as jnp
import numpy as np
from typing import Mapping, Optional, Sequence
from absl.testing import absltest
from absl.testing import parameterized
from rigl.experimental.jax.pruning import masked
from rigl.experimental.jax.pruning import symmetry
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Lint as: python3
"""Tests for weight_symmetry.pruning.symmetry."""




class MaskedDense(flax.deprecated.nn.Module):
  """Single-layer Dense Masked Network.

  Attributes:
    NUM_FEATURES: The number of neurons in the single dense layer.
  """

  NUM_FEATURES: int = 16

  def apply(self,
            inputs,
            mask = None):
    inputs = inputs.reshape(inputs.shape[0], -1)

# Path: rigl/experimental/jax/pruning/masked.py
# def masked(module, mask):
#   """Convenience function for masking a FLAX module with MaskedModule."""
#   return MaskedModule.partial(wrapped_module=module, mask=mask)
# 
# Path: rigl/experimental/jax/pruning/symmetry.py
# def count_permutations_mask_layer(
#     mask_layer,
#     next_mask_layer = None,
#     parameter_key = 'kernel'):
# def count_permutations_mask(mask):
# def get_mask_stats(mask):


# Path: rigl/experimental/jax/pruning/symmetry_test.py
import functools
import math
import operator
import flax
import jax
import jax.numpy as jnp
import numpy as np
from typing import Mapping, Optional, Sequence
from absl.testing import absltest
from absl.testing import parameterized
from rigl.experimental.jax.pruning import masked
from rigl.experimental.jax.pruning import symmetry

# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Lint as: python3
"""Tests for weight_symmetry.pruning.symmetry."""




class MaskedDense(flax.deprecated.nn.Module):
  """Single-layer Dense Masked Network.

  Attributes:
    NUM_FEATURES: The number of neurons in the single dense layer.
  """

  NUM_FEATURES: int = 16

  def apply(self,
            inputs,
            mask = None):
    inputs = inputs.reshape(inputs.shape[0], -1)

    return masked.MaskedModule(