-
Notifications
You must be signed in to change notification settings - Fork 755
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
integrate nn.image.flip #5411
integrate nn.image.flip #5411
Conversation
duchengyao
commented
Jul 7, 2021
•
edited
Loading
edited
assert all([len(image.shape) == 4 for image in images]) | ||
|
||
image_static_shape = _get_images_static_shape(images) | ||
flip_codes = flow.Tensor([1, 1], dtype=flow.int8) |
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.
为何这里的flip_codes是[1, 1]? 应该直接传一个1, 在Module内部根据多少张image将它扩成[1, 1]
>>> image_tensor_buffer = flow.tensor_to_tensor_buffer(image_tensors, instance_dims=3) | ||
>>> flip_codes = flow.Tensor([1,1],dtype=flow.int8) | ||
>>> output = nn.image.flip()(image_tensor_buffer, flip_codes) | ||
""" |
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.
这里发一下文档和doctest的截图
oneflow/python/nn/modules/dataset.py
Outdated
self._op = ( | ||
flow.builtin_op("image_flip") | ||
.Input("in") | ||
.Input("flip_code") |
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.
建议将flip_code初始化就传进来,而不是forward的时候,这样更符合Module
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.
把这个op放到functor里面去
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.
建个dataset_functor.cpp吗? @BBuf
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.
#5402 这个为啥不是functor的,有没有跟image/dataset有关的functor我可以抄一下
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.
@@ -0,0 +1,36 @@ | |||
#include "oneflow/core/framework/op_builder.h" |
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.
这里没有format
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.
你能先帮我看看怎么把代码跑起来吗
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.
好
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.
谢谢大佬