Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update from_blob api #51773

Merged
merged 1 commit into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions paddle/phi/api/include/tensor_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@ using Deleter = std::function<void(void*)>;
* @param dtype The data type of the tensor, should correspond to data type of
* `data`. See PD_FOR_EACH_DATA_TYPE in `phi/common/data_type.h`
* @param layout The data layout of the tensor.
* @param place The place where the tensor is located, should correspond to
* place of `data`.
* If `place` use the default value, it will be inferred from
* `data`, However,the feature is only supported on CPU or GPU.
* So make sure that `place` is equal to the place of `data` when
* using other devices.
* @param place The place where the tensor is located.
* If `place` is default value, it will be inferred from `data`,
* However,the feature is only supported on CPU or GPU.
* If `place` is not default value, make sure that `place` is equal
* to the place of `data`
* @param deleter A function or function object that will be called to free the
* memory buffer.
*
Expand Down
4 changes: 0 additions & 4 deletions paddle/phi/api/lib/tensor_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ limitations under the License. */

#include "paddle/phi/api/include/tensor_utils.h"

#include <set>

#include "paddle/phi/api/lib/api_registry.h"
#include "paddle/phi/core/dense_tensor.h"

Expand Down Expand Up @@ -72,8 +70,6 @@ PADDLE_API Tensor from_blob(void* data,
phi::errors::InvalidArgument(
"shape cannot be constructed from a Tensor."));

// TODO(huangjiyi): We need copy data to specified place when
// the input place is different with place of data.
phi::Place data_place;
if (place.GetType() == phi::AllocationType::UNDEFINED ||
place.GetType() == phi::AllocationType::CPU ||
Expand Down