-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Support double precision #4455
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
Support double precision #4455
Conversation
paddle/framework/operator.h
Outdated
int place = key.place_.which(); | ||
int data_type = static_cast<int>(key.data_type_); | ||
// NOTE: Number of places limit to 16. | ||
int pre_hash = data_type << 4 | (place & 0x0F); |
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.
Why we need a pre_hash here?
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.
Because we should hash two private data together. So I combine them manually.
|
||
// indicate kernel DataType by input data. Defaultly all input data must be | ||
// same. | ||
virtual DataType IndicateDataType(const ExecutionContext& ctx) const { |
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.
Maybe InferDataType is a better name.
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.
Actually, it is not an inference
, i.e., it is not inference the output data type by inputs. It indicates the kernel data type.
Please refer to REGISTER_OP_KERNEL.
|
Actually, no. It is not needed. The datatype is stored in |
23c434c
to
2c05465
Compare
e38db7f
to
f1913d4
Compare
1ca9e77
to
ae3dca7
Compare
paddle/framework/operator.h
Outdated
int place = key.place_.which(); | ||
int data_type = static_cast<int>(key.data_type_); | ||
// NOTE: Number of places limit to 16. | ||
int pre_hash = data_type << 4 | (place & 0x0F); |
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.
define 4 and 0x0f somewhere.
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.
Done.
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.
Maybe we can have a universal method, HashCombine.
Please refer to Hash64Combine in tensorflow
…addle_support_double
…addle_support_double
paddle/framework/op_registry.h
Outdated
|
||
template <typename PlaceType, size_t I, typename... KernelType> | ||
struct OpKernelRegistrarFunctor<PlaceType, false, I, KernelType...> { | ||
using KT = typename std::tuple_element<I, std::tuple<KernelType...>>::type; |
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.
It's hard to associate KT
with 'kernel type'. I think KERNEL_TYPE
is better.
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.
Done.
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.
LGTM. Many thanks!
* fix paddle.get_default_dtype Chinese and English return values are inconsistent * fix paddle.matmul 文档评估 #4407 把函数的输出改成正确的 * fix paddle.std文档评估 #4370 增加了一个unbiased=False的代码示例,没有增加numpy,怕引起误会。 * fix paddle.load文档测评 #4455 只把代码拆分了5段 * try * try * try * Update io.py * Update io.py * Update creation.py * Update creation.py * [Docs]add name description * [Docs]fix broadcasting issue Co-authored-by: Ligoml <39876205+Ligoml@users.noreply.github.com>
#Fix #4454