joddiy commented on a change in pull request #736:
URL: https://github.com/apache/singa/pull/736#discussion_r440637288
##########
File path: python/singa/autograd.py
##########
@@ -4698,6 +4698,103 @@ def cossim(a, b):
return CosSim()(a, b)[0]
+class Expand(Operator):
+ """
+ Init a expand operator
Review comment:
I've added an example usage at the comment.
The `expand` duplicates the data along with the axis. It looks like
`upsample` but still has some differences.
>
Example usage::
data = [[1.], [2.], [3.]]
# dim_changed
shape = [2, 1, 6]
output = [[[1., 1., 1., 1., 1., 1.],
[2., 2., 2., 2., 2., 2.],
[3., 3., 3., 3., 3., 3.]],
[[1., 1., 1., 1., 1., 1.],
[2., 2., 2., 2., 2., 2.],
[3., 3., 3., 3., 3., 3.]]]
# dim_unchanged
shape = [3, 4]
output = [[1., 1., 1., 1.],
[2., 2., 2., 2.],
[3., 3., 3., 3.]]
>
For upsample
>
Example usage::
data = [[[[1, 2],
[3, 4],]]]
# nearest
scales = [1.0, 1.0, 2.0, 3.0]
output = [[[[1, 1, 1, 2, 2, 2],
[1, 1, 1, 2, 2, 2],
[3, 3, 3, 4, 4, 4],
[3, 3, 3, 4, 4, 4],]]]
>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]