--- Fix namespace qualification for cast functions in amp_utils.h --- --- The code was using unqualified `sparse::cast_ad_func` and `cast_ad_func` which --- don't exist. They should use the full namespace qualifier like the non-trace_backward --- paths do: `paddle::experimental::sparse::cast` and `paddle::experimental::cast`. --- --- This fixes compilation errors: --- error: use of undeclared identifier 'sparse' --- error: no member named 'cast_ad_func' in namespace 'paddle::experimental::sparse' --- error: use of undeclared identifier 'cast_ad_func' --- paddle/fluid/imperative/amp_utils.h.orig 2024-12-20 00:00:00 UTC +++ paddle/fluid/imperative/amp_utils.h @@ -229,14 +229,14 @@ static inline paddle::Tensor Cast(const paddle::Tenso const bool trace_backward = true) { if (input.is_sparse_coo_tensor() || input.is_sparse_csr_tensor()) { if (trace_backward) { - return sparse::cast_ad_func(input, phi::DataType::UNDEFINED, dst_dtype); + return paddle::experimental::sparse::cast(input, phi::DataType::UNDEFINED, dst_dtype); } else { return paddle::experimental::sparse::cast( input, phi::DataType::UNDEFINED, dst_dtype); } } else { if (trace_backward) { - return cast_ad_func(input, dst_dtype); + return paddle::experimental::cast(input, dst_dtype); } else { return paddle::experimental::cast(input, dst_dtype); }