Repository navigation
【Hackathon 5th No.15】 为 Paddle 新增 Tensor.to() 以及 Layer.astype() API -part - #58244
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
|
@zhwesky2010 目前ci还剩3个没有过,codestyle是因为 |
| for dtype in valid_dtypes: | ||
| net = net.astype(dtype) | ||
| typex_str = str(net._dtype) | ||
| self.assertEqual((typex_str == "paddle." + dtype), True) |
There was a problem hiding this comment.
测一下 实际parameter参数的dtype吧,这个只测了layer.dtype
There was a problem hiding this comment.
新增了对layer param以及buffer的类型测试
| typex_str = str(net._dtype) | ||
| self.assertEqual((typex_str == "paddle." + dtype), True) | ||
| param_typex_str = str(net.parameters()[0].dtype) | ||
| self.assertEqual((param_typex_str == "paddle." + dtype), True) |
There was a problem hiding this comment.
这里直接使用 self.assertTrue(param_typex_str, 'paddle.' + dtype) 不更简洁吗,建议后面可以优化下写法
There was a problem hiding this comment.
已经优化写法,麻烦老师有空的时候再次审核一下
| If set str, it can be "bool", "float16", "float32", "float64", | ||
| "int8", "int16", "int32", "int64", "uint8", "complex64", "complex128". |
| "dtype value error, must be 'bfloat16', 'float16', 'float32', 'float64', 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'complex64', 'complex128', 'bool', or paddle.dtype, numpy.dtype, but recieve " | ||
| + str(dtype) |
Co-authored-by: zachary sun <70642955+sunzhongkai588@users.noreply.github.com>
sunzhongkai588
left a comment
There was a problem hiding this comment.
LGTM, 用 pre-commit 修一下风格检查的问题吧
昨天已经修过了,目前codestyle的CI已经过了 |
|
@YibinLiu666 请提交对应的中文文档 |
|
hi, @YibinLiu666
|
…part (PaddlePaddle#58244) * support tensor.to and layer.astype * add UT and comments * update * update com * update dtype * fix example test * update example * add some ut to fix ci-coverage * fix codestyle * fix codestyle * update * add ut to test layer params' and buffers' type * update test * fix doc * Update python/paddle/base/dygraph/tensor_patch_methods.py Co-authored-by: zachary sun <70642955+sunzhongkai588@users.noreply.github.com> * update doc --------- Co-authored-by: zachary sun <70642955+sunzhongkai588@users.noreply.github.com>
…part (PaddlePaddle#58244) * support tensor.to and layer.astype * add UT and comments * update * update com * update dtype * fix example test * update example * add some ut to fix ci-coverage * fix codestyle * fix codestyle * update * add ut to test layer params' and buffers' type * update test * fix doc * Update python/paddle/base/dygraph/tensor_patch_methods.py Co-authored-by: zachary sun <70642955+sunzhongkai588@users.noreply.github.com> * update doc --------- Co-authored-by: zachary sun <70642955+sunzhongkai588@users.noreply.github.com>
PR types
New features
PR changes
APIs
Description
RFC: PaddlePaddle/community#690