Exemplo n.º 1
0
_SUM_OF_SIZE_ZERO_TENSORS_TEST = dict(
    testcase_name='SumOfSizeZeroTensors',
    combiner=analyzers.NumPyCombiner(fn=np.sum,
                                     default_accumulator_value=0,
                                     output_dtypes=[np.int64],
                                     output_shapes=[None]),
    batches=[
        (np.array([]), ),
        (np.array([]), ),
    ],
    expected_outputs=[np.array([], np.int64) * 2],
)

_COVARIANCE_SIZE_ZERO_TENSORS_TEST = dict(
    testcase_name='CovarianceSizeZeroTensors',
    combiner=analyzers.CovarianceCombiner(output_shape=(0, 0),
                                          numpy_dtype=np.float64),
    batches=[
        (np.empty((1, 0)), ),
        (np.empty((2, 0)), ),
    ],
    expected_outputs=[np.empty((0, 0), dtype=np.float64)],
)

_COVARIANCE_WITH_DEGENERATE_COVARIANCE_MATRIX_TEST = dict(
    testcase_name='CovarianceWithDegenerateCovarianceMatrix',
    combiner=analyzers.CovarianceCombiner(output_shape=(3, 3),
                                          numpy_dtype=np.float64),
    batches=[
        (np.array([[0, 0, 1]]), ),
        (np.array([[4, 0, 1], [2, -1, 1]]), ),
        (np.array([[2, 1, 1]]), ),
Exemplo n.º 2
0
    expected_outputs=[np.array(3)],
)

_SUM_OF_SIZE_ZERO_TENSORS_TEST = dict(
    testcase_name='SumOfSizeZeroTensors',
    combiner=analyzers.NumPyCombiner(np.sum, output_dtypes=[np.int64]),
    batches=[
        (np.array([]), ),
        (np.array([]), ),
    ],
    expected_outputs=[np.array([], np.int64) * 2],
)

_COVARIANCE_SIZE_ZERO_TENSORS_TEST = dict(
    testcase_name='CovarianceSizeZeroTensors',
    combiner=analyzers.CovarianceCombiner(numpy_dtype=np.float64),
    batches=[
        (np.empty((1, 0)), ),
        (np.empty((2, 0)), ),
    ],
    expected_outputs=[np.empty((0, 0), dtype=np.float64)],
)

_COVARIANCE_WITH_DEGENERATE_COVARIANCE_MATRIX_TEST = dict(
    testcase_name='CovarianceWithDegenerateCovarianceMatrix',
    combiner=analyzers.CovarianceCombiner(numpy_dtype=np.float64),
    batches=[
        (np.array([[0, 0, 1]]), ),
        (np.array([[4, 0, 1], [2, -1, 1]]), ),
        (np.array([[2, 1, 1]]), ),
    ],