



import unittest

from transformers.utils.backbone_utils import (
    BackboneMixin,
    get_aligned_output_features_output_indices,
    verify_out_features_out_indices,
)



class     UpperCAmelCase_       (			unittest.TestCase):







							def   snake_case__ (  self):

														'''simple docstring'''

														_lowerCAmelCase	:				int					  =       ['a', 'b', 'c']

														# Defaults to last layer if both are None
														_lowerCAmelCase	:				str					  =       get_aligned_output_features_output_indices(_SCREAMING_SNAKE_CASE,     _SCREAMING_SNAKE_CASE,     _SCREAMING_SNAKE_CASE)
														self.assertEqual(_SCREAMING_SNAKE_CASE,     ["c"])
														self.assertEqual(_SCREAMING_SNAKE_CASE,     [2])

														# Out indices set to match out features
														_lowerCAmelCase	:				Tuple					  =       get_aligned_output_features_output_indices(["a", "c"],     _SCREAMING_SNAKE_CASE,     _SCREAMING_SNAKE_CASE)
														self.assertEqual(_SCREAMING_SNAKE_CASE,     ["a", "c"])
														self.assertEqual(_SCREAMING_SNAKE_CASE,     [0, 2])

														# Out features set to match out indices
														_lowerCAmelCase	:				Optional[Any]					  =       get_aligned_output_features_output_indices(_SCREAMING_SNAKE_CASE,     [0, 2],     _SCREAMING_SNAKE_CASE)
														self.assertEqual(_SCREAMING_SNAKE_CASE,     ["a", "c"])
														self.assertEqual(_SCREAMING_SNAKE_CASE,     [0, 2])

														# Out features selected from negative indices
														_lowerCAmelCase	:				List[str]					  =       get_aligned_output_features_output_indices(_SCREAMING_SNAKE_CASE,     [-3, -1],     _SCREAMING_SNAKE_CASE)
														self.assertEqual(_SCREAMING_SNAKE_CASE,     ["a", "c"])
														self.assertEqual(_SCREAMING_SNAKE_CASE,     [-3, -1])







							def   snake_case__ (  self):

														'''simple docstring'''

														with self.assertRaises(_SCREAMING_SNAKE_CASE):
																					verify_out_features_out_indices(["a", "b"],     (0, 1),     _SCREAMING_SNAKE_CASE)

														# Out features must be a list
														with self.assertRaises(_SCREAMING_SNAKE_CASE):
																					verify_out_features_out_indices(("a", "b"),     (0, 1),     ["a", "b"])

														# Out features must be a subset of stage names
														with self.assertRaises(_SCREAMING_SNAKE_CASE):
																					verify_out_features_out_indices(["a", "b"],     (0, 1),     ["a"])

														# Out indices must be a list or tuple
														with self.assertRaises(_SCREAMING_SNAKE_CASE):
																					verify_out_features_out_indices(_SCREAMING_SNAKE_CASE,     0,     ["a", "b"])

														# Out indices must be a subset of stage names
														with self.assertRaises(_SCREAMING_SNAKE_CASE):
																					verify_out_features_out_indices(_SCREAMING_SNAKE_CASE,     (0, 1),     ["a"])

														# Out features and out indices must be the same length
														with self.assertRaises(_SCREAMING_SNAKE_CASE):
																					verify_out_features_out_indices(["a", "b"],     (0,),     ["a", "b", "c"])

														# Out features should match out indices
														with self.assertRaises(_SCREAMING_SNAKE_CASE):
																					verify_out_features_out_indices(["a", "b"],     (0, 2),     ["a", "b", "c"])

														# Out features and out indices should be in order
														with self.assertRaises(_SCREAMING_SNAKE_CASE):
																					verify_out_features_out_indices(["b", "a"],     (0, 1),     ["a", "b"])

														# Check passes with valid inputs
														verify_out_features_out_indices(["a", "b", "d"],     (0, 1, -1),     ["a", "b", "c", "d"])







							def   snake_case__ (  self):

														'''simple docstring'''

														_lowerCAmelCase	:				Optional[int]					  =       BackboneMixin()

														_lowerCAmelCase	:				Optional[int]					  =       ['a', 'b', 'c']
														_lowerCAmelCase	:				Tuple					  =       ['a', 'c']
														_lowerCAmelCase	:				Any					  =       [0, 2]

														# Check that the output features and indices are set correctly
														self.assertEqual(backbone.out_features,     ["a", "c"])
														self.assertEqual(backbone.out_indices,     [0, 2])

														# Check out features and indices are updated correctly
														_lowerCAmelCase	:				Optional[int]					  =       ['a', 'b']
														self.assertEqual(backbone.out_features,     ["a", "b"])
														self.assertEqual(backbone.out_indices,     [0, 1])

														_lowerCAmelCase	:				Union[str, Any]					  =       [-3, -1]
														self.assertEqual(backbone.out_features,     ["a", "c"])
														self.assertEqual(backbone.out_indices,     [-3, -1])





"""simple docstring"""

# NOTE: This file is deprecated and will be removed in a future version.
# It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works

from ...utils import deprecate
from ..controlnet.pipeline_flax_controlnet import FlaxStableDiffusionControlNetPipeline  # noqa: F401


deprecate(
    'stable diffusion controlnet',
    '0.22.0',
    'Importing `FlaxStableDiffusionControlNetPipeline` from diffusers.pipelines.stable_diffusion.flax_pipeline_stable_diffusion_controlnet is deprecated. Please import `from diffusers import FlaxStableDiffusionControlNetPipeline` instead.',
    standard_warn=False,
    stacklevel=3,
)





