You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@singa.apache.org by GitBox <gi...@apache.org> on 2020/09/02 02:21:54 UTC

[GitHub] [singa] dcslin commented on pull request #750: add SpaceToDepth && DepthToSpace operators

dcslin commented on pull request #750:
URL: https://github.com/apache/singa/pull/750#issuecomment-685245437


   > > > > @dcslin
   > > > > Hi, shicong, the cuda cannot support transpose with more than 4 dims, right?
   > > > > ```
   > > > > F0622 09:52:01.832056 31992 tensor_math_cuda.h:61] Check failed: shape.size() <= 5 (6 vs. 5) Dimensions (shape) beyond 5 are currently not supported
   > > > > ```
   > > > 
   > > > 
   > > > hi joddiy, could you help to review this PR to your branch: [joddiy#3](https://github.com/joddiy/incubator-singa/pull/3)
   > > 
   > > 
   > > Hi, shicong, this PR still has some problems. When we do `reshape->transpose->reshape`, each step is correct, however, once we concat these three operators together, the result is wrong. Please use this code to test:
   > > ```
   > >     def test_reshape(self):
   > >         X = np.array(
   > >             [[[[0., 1., 2.], [3., 4., 5.]], [[9., 10., 11.], [12., 13., 14.]],
   > >               [[18., 19., 20.], [21., 22., 23.]],
   > >               [[27., 28., 29.], [30., 31., 32.]],
   > >               [[36., 37., 38.], [39., 40., 41.]],
   > >               [[45., 46., 47.], [48., 49., 50.]],
   > >               [[54., 55., 56.], [57., 58., 59.]],
   > >               [[63., 64., 65.], [66., 67., 68.]]]],
   > >             dtype=np.float32)
   > >         x = tensor.from_numpy(X)
   > >         x.to_device(gpu_dev)
   > > 
   > >         y_t = np.reshape(X, [1, 2, 2, 2, 2, 3])
   > >         y_t = np.transpose(y_t, [0, 3, 4, 1, 5, 2])
   > >         y_t = np.reshape(y_t, [1, 2, 4, 6])
   > > 
   > >         y = singa.Reshape(x.data, [1, 2, 2, 2, 2, 3])
   > >         y = singa.Transpose(y, [0, 3, 4, 1, 5, 2])
   > >         y = singa.Reshape(y, [1, 2, 4, 6])
   > > 
   > >         np.testing.assert_array_almost_equal(tensor.to_numpy(tensor.from_raw_tensor(y)), y_t)
   > > ```
   > 
   > ok checking
   
   Please refer to https://github.com/joddiy/incubator-singa/pull/3/files


----------------------------------------------------------------
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:
users@infra.apache.org