@@ -3138,20 +3138,22 @@ def func(x):
3138
3138
self ._run_test_case (func , [_OUTPUT ], {_INPUT : x_val })
3139
3139
3140
3140
@check_opset_min_version (12 )
3141
- def test_less_or_equal (self ):
3141
+ def test_squared_distance (self ):
3142
3142
x_val = np .random .random ([4 , 5 ]).astype (np .float32 )
3143
3143
y_val = np .random .random ([4 , 5 ]).astype (np .float32 )
3144
3144
def func (x , y ):
3145
- return tf .math .less_equal (x , y , name = _TFOUTPUT )
3145
+ return tf .math .squared_difference (x , y , name = _TFOUTPUT )
3146
3146
self ._run_test_case (func , [_OUTPUT ], {_INPUT : x_val , _INPUT1 : y_val })
3147
3147
3148
3148
@check_opset_min_version (12 )
3149
- def test_squared_distance (self ):
3150
- x_val = np .random .random ([4 , 5 ]).astype (np .float32 )
3151
- y_val = np .random .random ([4 , 5 ]).astype (np .float32 )
3149
+ @check_tf_min_version ("2.1" )
3150
+ def test_einsum (self ):
3151
+ x_val = np .random .random ([10 ]).astype (np .float32 )
3152
+ y_val = np .random .random ([10 ]).astype (np .float32 )
3152
3153
def func (x , y ):
3153
- return tf .math .squared_difference (x , y , name = _TFOUTPUT )
3154
- self ._run_test_case (func , [_OUTPUT ], {_INPUT : x_val , _INPUT1 : y_val })
3154
+ ret = tf .einsum ("i,j->ij" , x , y )
3155
+ return tf .identity (ret , name = _TFOUTPUT )
3156
+ self ._run_test_case (func , [_OUTPUT ], {_INPUT : x_val , _INPUT1 : y_val })
3155
3157
3156
3158
3157
3159
if __name__ == '__main__' :
0 commit comments