12
12
// See the License for the specific language governing permissions and
13
13
// limitations under the License.
14
14
15
- #include " paddle/contrib/inference/paddle_inference_api_anakin_engine.h"
16
15
#include < cuda.h>
16
+ #include " paddle/contrib/inference/paddle_inference_api_anakin_engine.h"
17
17
18
18
namespace paddle {
19
19
@@ -47,8 +47,7 @@ bool PaddleInferenceAnakinPredictor::Run(
47
47
}
48
48
auto d_tensor_in_p = executor_.get_in (input.name );
49
49
float *d_data_p = d_tensor_in_p->mutable_data ();
50
- if (cudaMemcpy (d_data_p,
51
- static_cast <float *>(input.data .data ()),
50
+ if (cudaMemcpy (d_data_p, static_cast <float *>(input.data .data ()),
52
51
d_tensor_in_p->valid_size () * sizeof (float ),
53
52
cudaMemcpyHostToDevice) != 0 ) {
54
53
LOG (ERROR) << " copy data from CPU to GPU error" ;
@@ -70,8 +69,7 @@ bool PaddleInferenceAnakinPredictor::Run(
70
69
output.data .Resize (tensor->valid_size () * sizeof (float ));
71
70
}
72
71
// Copy data from GPU -> CPU
73
- if (cudaMemcpy (output.data .data (),
74
- tensor->mutable_data (),
72
+ if (cudaMemcpy (output.data .data (), tensor->mutable_data (),
75
73
tensor->valid_size () * sizeof (float ),
76
74
cudaMemcpyDeviceToHost) != 0 ) {
77
75
LOG (ERROR) << " copy data from GPU to CPU error" ;
@@ -106,9 +104,8 @@ std::unique_ptr<PaddlePredictor> PaddleInferenceAnakinPredictor::Clone() {
106
104
107
105
// A factory to help create difference predictor.
108
106
template <>
109
- std::unique_ptr<PaddlePredictor>
110
- CreatePaddlePredictor<AnakinConfig, PaddleEngineKind::kAnakin >(
111
- const AnakinConfig &config) {
107
+ std::unique_ptr<PaddlePredictor> CreatePaddlePredictor<
108
+ AnakinConfig, PaddleEngineKind::kAnakin >(const AnakinConfig &config) {
112
109
VLOG (3 ) << " Anakin Predictor create." ;
113
110
std::unique_ptr<PaddlePredictor> x (
114
111
new PaddleInferenceAnakinPredictor (config));
0 commit comments