【UnitTestFix No.10】fix test_normal.py #75274
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Category
Operator Mechanism
PR Types
Bug fixes
Description
报错Info
由于内容太多,就不放在PR中了,链接:test_normal_info
Error主要三类
AttributeError: 'Tensor' object has no attribute 'desc'
TestNormalAPIexe.run(fetch_list=[out])拿到的不是静态图 VariableAssertionError: data() is only supported in static graph mode
TestNormalAPI_mean_is_tensorTestNormalAPI_std_is_tensorTestNormalAPI_mean_std_are_tensorTestNormalAPI_mean_std_are_tensor_with_different_dtypeTestNormalAPIComplex系列paddle.static.data()在动态图模式下调用Mismatch
TestNormalAPIComplex*系列修改
TestNormalAPIexe.run(fetch_list=[out])拿到的不是静态图 Variablestatic_api()开头调用paddle.enable_static(),结束调用paddle.disable_static(),保证out是静态图 VariableTestNormalAPI_mean_is_tensorpaddle.static.data()在动态图模式下调用static_api中启用静态图:paddle.enable_static(),包裹paddle.static.data()TestNormalAPI_std_is_tensorTestNormalAPI_mean_std_are_tensorTestNormalAPI_mean_std_are_tensor_with_different_dtypeTestNormalAPIComplexmeandtype 为"complex128";feed 时使用np.broadcast_to(self.mean, self.std.shape)TestNormalAPIComplex_mean_is_tensorTestNormalAPIComplex_std_is_tensorTestNormalAPIComplex_mean_std_are_tensorTestNormalAPIComplex_mean_std_are_tensor_with_different_dtype结果
@luotao1 @YqGe585