pose_format.tensorflow.masked.tensor_test module

Classes:

TestMaskedTensor([methodName])

Unit tests for the MaskedTensor class.

Functions:

create_random_numpy_tensor_and_mask(shape, ...)

Creates a random numpy tensor and a corresponding mask.

class pose_format.tensorflow.masked.tensor_test.TestMaskedTensor(methodName='runTest')[source]

Bases: TestCase

Unit tests for the MaskedTensor class.

Methods:

test_fix_nan()

Test if NaN values in a MaskedTensor are fixed (removed).

test_float_eager_execution_return_type_is_correct()

Test if a MaskedTensor can be correctly cast to a float during eager execution.

test_mean()

Test if the computed mean of a MaskedTensor matches the numpy MaskedArray.

test_reshape_identical_to_numpy_reshape()

Test if the reshape method of a MaskedTensor produces results identical to numpy's reshape.

test_reshape_return_type_is_correct()

Test if the return type of the reshape method of a MaskedTensor is itself a MaskedTensor.

test_std()

Test if the computed standard deviation of a MaskedTensor matches the numpy MaskedArray.

test_fix_nan()[source]

Test if NaN values in a MaskedTensor are fixed (removed).

test_float_eager_execution_return_type_is_correct()[source]

Test if a MaskedTensor can be correctly cast to a float during eager execution.

test_mean()[source]

Test if the computed mean of a MaskedTensor matches the numpy MaskedArray.

test_reshape_identical_to_numpy_reshape()[source]

Test if the reshape method of a MaskedTensor produces results identical to numpy’s reshape.

test_reshape_return_type_is_correct()[source]

Test if the return type of the reshape method of a MaskedTensor is itself a MaskedTensor.

test_std()[source]

Test if the computed standard deviation of a MaskedTensor matches the numpy MaskedArray.

pose_format.tensorflow.masked.tensor_test.create_random_numpy_tensor_and_mask(shape, probability_for_masked, num_nans=0)[source]

Creates a random numpy tensor and a corresponding mask.

Parameters:
  • shape (Tuple) – The desired shape of the tensor.

  • probability_for_masked (float) – The probability that an element is masked.

  • num_nans (int, optional) – Number of NaNs to be inserted into the tensor, default is 0.

Returns:

A tuple containing the generated tensor and its corresponding mask.

Return type:

Tuple[np.array, np.array]