# 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)


from typing import Any, Callable, Mapping
from rigl.experimental.jax.pruning import masked
import flax
import jax.numpy as jnp
# coding=utf-8
# Copyright 2022 RigL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# 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
"""Pruning mask factory.

Attributes:
  MaskFnType: A type alias for functions to create sparse masks.
  MASK_TYPES: Masks types that can be created.
"""



# A function to create a mask, takes as arguments: a flax model, JAX PRNG Key,
# sparsity level as a float in [0, 1].
MaskFnType = Callable[
    [flax.deprecated.nn.Model, Callable[[int],

# 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/mask_factory.py
from typing import Any, Callable, Mapping
from rigl.experimental.jax.pruning import masked
import flax
import jax.numpy as jnp

# coding=utf-8
# Copyright 2022 RigL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# 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
"""Pruning mask factory.

Attributes:
  MaskFnType: A type alias for functions to create sparse masks.
  MASK_TYPES: Masks types that can be created.
"""



# A function to create a mask, takes as arguments: a flax model, JAX PRNG Key,
# sparsity level as a float in [0, 1].
MaskFnType = Callable[
    [flax.deprecated.nn.Model, Callable[[int],

                                        jnp.array], float], masked.MaskType]