
    2Vh5                         d dl Z	 ddZd Zy)    Nc           	         t         j                  j                  |       | |z   }||z  }t        j                  t	        |      D cg c]  }t	        |      D ]  }|  c}}t         j
                        }	|t        |	      z
  }
t        j                  t	        |
      D cg c]  }||z  	 c}t         j                        }t        j                  |	|g      }	d|z  t         j                  j                  |f|z         z  }t        j                  |f|z   t         j                        }t	        |      D ]0  }||	|      t         j                  j                  dd|      z   ||<   2 t        j                  |      }t         j                  j                  |       ||   |	|   }	}g g g g f\  }}}}t	        |      D ]  }t        j                  |	|k(        d   }t         j                  j                  |       t        | |z        }|j!                  ||d|           |j!                  |	|d|           |j!                  |||d           |j!                  |	||d            t        j                  |      t        j                  |      }}t        j                  |      t        j                  |      }}t        j                  t        |            }t        j                  t        |            }t         j                  j                  |       t         j                  j                  |       ||   ||   }}||   ||   }}||f||ffS c c}}w c c}w )a  Generates balanced, stratified synthetic test data to train a model on.

    Args:
        train_samples: Integer, how many training samples to generate.
        test_samples: Integer, how many test samples to generate.
        input_shape: Tuple of integers, shape of the inputs.
        num_classes: Integer, number of classes for the data and targets.
        random_seed: Integer, random seed used by Numpy to generate data.

    Returns:
        A tuple of Numpy arrays: `(x_train, y_train), (x_test, y_test)`.
    )dtype   r   g      ?)locscalesizeN)nprandomseedarrayrangeint32lenint64concatenatezerosfloat32normalarangeshufflewhereintextend)train_samplestest_samplesinput_shapenum_classesrandom_seedtotal_samplessamples_per_classi_yextra_samplesy_extra	templatesxindicesx_trainy_trainx_testy_testclscls_indicestrain_counttrain_indicestest_indicess                           L/home/dcms/DCMS/lib/python3.12/site-packages/keras/src/testing/test_utils.pyget_test_datar3      s    IINN; "L0M &4
+&Iq6G0HI1IIhh	A "CF*Mhh"'"67Q[7rxxG 	7|$A K"))"2"2K>K3O"PPI
-!K/rzzBA=! 
1!1!1; "2 "
 
!
 ii&GIIgW:qzqA (*2r2~$GWff[! 	4hhqCx(+
		+&-+56q\k234q\k234aKL123aKL123	4 xx("((7*;WGXXf%rxx'7FF IIc'l+M99S[)LIIm$IIl#}-w}/EWGL)6,+?FFW///e 	J 	8s   M
"Mc                  D  
 d 
| t        
fd|j                         D              z   }i g}|D ]n  }g }|D ]c  }|D ]\  }|j                  dd      }||rdndz  }||d   z  }|j                         }	|	j	                  |       ||	d<   |j                  |	       ^ e |}p |S )a  Utility to generate the cartesian product of parameters values and
    generate a test case names for each combination.

    The result of this function is to be used with the
    `@parameterized.named_parameters` decorator. It is a replacement for
    `@parameterized.product` which adds explicit test case names.

    For example, this code:
    ```
    class NamedExample(parameterized.TestCase):
        @parameterized.named_parameters(
            named_product(
                [
                    {'testcase_name': 'negative', 'x': -1},
                    {'testcase_name': 'positive', 'x': 1},
                    {'testcase_name': 'zero', 'x': 0},
                ],
                numeral_type=[float, int],
            )
        )
        def test_conversion(self, x, numeral_type):
            self.assertEqual(numeral_type(x), x)
    ```
    produces six tests (note that absl will reorder them by name):
    - `NamedExample::test_conversion_negative_float`
    - `NamedExample::test_conversion_positive_float`
    - `NamedExample::test_conversion_zero_float`
    - `NamedExample::test_conversion_negative_int`
    - `NamedExample::test_conversion_positive_int`
    - `NamedExample::test_conversion_zero_int`

    This function is also useful in the case where there is no product to
    generate test case names for one argument:
    ```
    @parameterized.named_parameters(named_product(numeral_type=[float, int]))
    ```

    Args:
        *args: Each positional parameter is a sequence of keyword arg dicts.
            Every test case generated will include exactly one dict from each
            positional parameter. These will then be merged to form an overall
            list of arguments for the test case. Each dict must contain a
            `"testcase_name"` key whose value is combined with others to
            generate the test case name.
        **kwargs: A mapping of parameter names and their possible values.
            Possible values should given as either a list or a tuple. A string
            representation of each value is used to generate the test case name.

    Returns:
        A list of maps for the test parameters combinations to pass to
        `@parameterized.named_parameters`.
    c                     t        | d      r| j                  j                         S t        |       j                         S )N__name__)hasattrr6   lowerstr)values    r2   value_to_strz#named_product.<locals>.value_to_str   s2    5*%>>''))5z!!    c              3   P   K   | ]  \  }t        fd |D                yw)c              3   6   K   | ]  }d  |      |i  yw)testcase_nameN ).0vkeyr;   s     r2   	<genexpr>z*named_product.<locals>.<genexpr>.<genexpr>   s     IQQa8Is   N)tuple)rA   valuesrC   r;   s     @r2   rD   z named_product.<locals>.<genexpr>   s(      "C 	I&II"s   "&r?    r"   )rE   itemsgetcopyupdateappend)argskwargsall_test_dictstests
test_dicts	new_tests	test_dicttestr?   new_testr;   s             @r2   named_productrV   P   s    l" E "!<<>"  N DE$ 
	# 
	+I 	+ $" =2=?!;;99;	*,9)  *	+
	+   Lr<   )N)numpyr	   r3   rV   r@   r<   r2   <module>rX      s     HLI0XSr<   