-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Add StringTensor #39830
Merged
Merged
Add StringTensor #39830
Changes from 45 commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
e43bf93
add string tensor and case convert kernels
joey12300 ecc0cbc
Add strings empty kernel; Reorganize the structure of case convert ke…
joey12300 de898cd
Add string infermeta
joey12300 f1c8c4b
Update mutable_data of string tensor
joey12300 a4f528c
merge develop
joey12300 e99a9dd
rename kernel name
joey12300 381c7ff
add string copy tmp
joey12300 374f253
Fix strings copy device bug
joey12300 da218cd
add utf8 gpu converter
joey12300 2cc6bb0
add string tensor c++ api
joey12300 c87eabb
Merge remote-tracking branch 'upstream' into add_string_tensor
joey12300 d94b946
Remove mutable_data of string tensor
joey12300 b743556
update string tensor interface
joey12300 0d5b397
remove charcases_flag.h
joey12300 14eb07d
Merge branch 'develop' into add_string_tensor
joey12300 57402b8
remove some fluid headers
joey12300 ffe8705
Add make_ddim
joey12300 c16f1ba
__HIPCC__ -> PADDLE_WITH_HIP
joey12300 a9928ca
remove fluid headers
joey12300 f6d5520
fix cpu compile
joey12300 d7d16a8
remove std::hash
joey12300 f623b60
Merge branch 'develop' of /~https://github.com/PaddlePaddle/Paddle into…
joey12300 986a10b
fix cmakelist conflics
joey12300 fa82d16
Merge branch 'develop' of /~https://github.com/PaddlePaddle/Paddle into…
joey12300 0d5bcaa
Merge branch 'develop' of /~https://github.com/PaddlePaddle/Paddle into…
joey12300 618b4f7
Fix cudaMalloc
joey12300 ebacdbd
Merge branch 'develop' of /~https://github.com/PaddlePaddle/Paddle into…
joey12300 74b1428
Remove strings/impl directory
joey12300 27df753
Merge branch 'develop' of /~https://github.com/PaddlePaddle/Paddle into…
joey12300 b0b84a1
Fix infrt/get_phi_kernel_info.py;Add custom_kernels deps
joey12300 683f51b
Add empty kernel test
joey12300 e13f7f8
Remove some comments
joey12300 e7594c3
Modify lower/upper api encoding type: string->bool
joey12300 b710687
STRING->PSTRING; Add CreateInferLikeMeta
joey12300 57726f2
Add code gen for C++ String API
joey12300 def03bb
merge develop
joey12300 7ba9a5d
remove strings_api_utils.h
joey12300 d8ede63
Add ignore file (strings_api.h, strings_api.cc)
joey12300 00bfcd2
update strings gen script
joey12300 8777dad
merge develop
joey12300 40906f8
change args order of case convert kernels
joey12300 e810f7d
Add comments for pstring, StringTensor
joey12300 8aa1225
cpstring_internal.h -> cpstring_impl.h
joey12300 3966a89
Update accordding to comments:
joey12300 afd509a
Remove all singletons in strings kernels
joey12300 43b449b
Merge branch 'develop' of /~https://github.com/PaddlePaddle/Paddle into…
joey12300 cd5873a
fix rocm compile
joey12300 a326602
Merge branch 'develop' of /~https://github.com/PaddlePaddle/Paddle into…
joey12300 a9de65f
Fix py3 compile
joey12300 c32e589
Fix c++ coverage
joey12300 30f5661
1. Add pstring proto type
joey12300 be3d5eb
DataLayout::PSTRING -> DataLayout::PSTRING_UNION
joey12300 b771d39
Register pstring data type
joey12300 87eadf9
Merge branch 'develop' of /~https://github.com/PaddlePaddle/Paddle into…
joey12300 23a6d2d
Fix strings api gen
joey12300 0d2845c
merge
joey12300 8d141eb
Fix dense tensor register pstring dtype
joey12300 6302677
Fix error messages
joey12300 bef8cbe
merge
joey12300 e2b962a
remove line
joey12300 5d22e58
add pstring unittest
joey12300 972ca57
Merge branch 'develop' of /~https://github.com/PaddlePaddle/Paddle into…
joey12300 67f8fb7
remove test string api unitest
joey12300 6f8decf
remove empty line
joey12300 71a8d1a
Remove some headers to decrease the size of executable file
joey12300 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
add_subdirectory(lib) | ||
cc_library(phi_api SRCS all.cc DEPS phi_function_api phi_bw_function_api sparse_api sparse_bw_api) | ||
cc_library(phi_api SRCS all.cc DEPS phi_function_api phi_bw_function_api sparse_api sparse_bw_api strings_api) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,4 @@ limitations under the License. */ | |
|
||
PD_DECLARE_API(Math); | ||
PD_DECLARE_API(SparseApi); | ||
PD_DECLARE_API(StringsApi); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,10 @@ std::shared_ptr<phi::SelectedRows> TensorToSelectedRows( | |
return nullptr; | ||
} | ||
|
||
std::shared_ptr<phi::StringTensor> TensorToStringTensor(const Tensor& tensor) { | ||
return std::dynamic_pointer_cast<phi::StringTensor>(tensor.impl()); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 没有太get这个函数的主要功能是什么? |
||
/* ----------------- for infer_meta --------------------- */ | ||
|
||
phi::MetaTensor MakeMetaTensor(const phi::DenseTensor& tensor) { | ||
|
@@ -92,6 +96,10 @@ paddle::optional<phi::MetaTensor> MakeMetaTensor( | |
return {paddle::none}; | ||
} | ||
|
||
phi::MetaTensor MakeMetaTensor(const phi::StringTensor& tensor) { | ||
return phi::MetaTensor(tensor); | ||
} | ||
|
||
/* ------------------ for output ----------------------- */ | ||
|
||
phi::DenseTensor* SetKernelOutput(Backend backend, Tensor* out) { | ||
|
@@ -148,5 +156,20 @@ phi::TensorBase* SetSparseKernelOutput(Tensor* out, TensorType type) { | |
return out->impl().get(); | ||
} | ||
|
||
phi::TensorBase* SetStringsKernelOutput(Backend backend, | ||
Tensor* out, | ||
TensorType type) { | ||
if (!out->initialized()) { | ||
auto place = phi::TransToPhiPlace(backend); | ||
if (type == TensorType::STRING_TENSOR) { | ||
auto strings_tensor = std::make_shared<phi::StringTensor>( | ||
paddle::memory::AllocShared(place, 0), phi::StringTensorMeta()); | ||
out->set_impl(strings_tensor); | ||
return strings_tensor.get(); | ||
} | ||
} | ||
return out->impl().get(); | ||
} | ||
|
||
} // namespace experimental | ||
} // namespace paddle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
cc_library(phi_api_utils SRCS storage.cc tensor_utils.cc DEPS | ||
tensor_base convert_utils dense_tensor lod_tensor selected_rows_utils place var_type_traits scalar) | ||
tensor_base convert_utils dense_tensor lod_tensor selected_rows_utils place var_type_traits scalar string_tensor) |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这块为什么返回RAW类型的数据了?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已添加PSTRING prototype,改为返回
paddle::framework::proto::VarType::RAW