|
|
|
@ -272,11 +272,10 @@ struct TensorSetConstantWithPlace : public boost::static_visitor<void> {
|
|
|
|
|
|
|
|
|
|
void set_constant(const platform::DeviceContext& context,
|
|
|
|
|
framework::Tensor* tensor, float value) {
|
|
|
|
|
TensorSetConstantWithPlace func(context, tensor, value);
|
|
|
|
|
#ifdef PADDLE_WITH_CUDA
|
|
|
|
|
boost::apply_visitor(TensorSetConstantWithPlace(context, tensor, value),
|
|
|
|
|
tensor->place());
|
|
|
|
|
tensor->place().apply_visitor(func);
|
|
|
|
|
#else
|
|
|
|
|
TensorSetConstantWithPlace func(context, tensor, value);
|
|
|
|
|
func(platform::CPUPlace());
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|