def testCombineSoftLongPartial(self): left = SoftTensorTypeModel([5,10], soft_by_dimensions=[True, False]) right = SoftTensorTypeModel([5,10,3,10,2,5], soft_by_dimensions=[True, False, True, False, False, True]) helper = SoftTensorBinaryOperatorHelper() combined_dims, combined_softness = helper.get_combine_type_dimensions(left, right, "test_combine") self.assertIsNotNone(combined_dims) self.assertEqual(len(combined_dims), 6) self.assertEqual([5,10,3,10,2,5], combined_dims) self.assertEqual(len(combined_softness), 6) self.assertEqual([True, False, True, False, False, True], combined_softness)
def testCombineSoftExpandsToMultipleHardSingulars(self): left = SoftTensorTypeModel([1,10,1], soft_by_dimensions=[False, False, False]) right = SoftTensorTypeModel([5,10,3], soft_by_dimensions=[True, False, True]) helper = SoftTensorBinaryOperatorHelper() combined_dims, combined_softness = helper.get_combine_type_dimensions(left, right, "test_combine") self.assertIsNotNone(combined_dims) self.assertEqual(len(combined_dims), 3) self.assertEqual([5,10,3], combined_dims) self.assertEqual(len(combined_softness), 3) self.assertEqual([True, False, True], combined_softness)