You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/04/10 20:08:07 UTC

[GitHub] hnhuang commented on issue #7582: Gluon GPU memory efficiency

hnhuang commented on issue #7582: Gluon GPU memory efficiency
URL: https://github.com/apache/incubator-mxnet/issues/7582#issuecomment-324477834
 
 
   If I only use vgg+fcn, then I can set batch_size = 64 for tf+keras and gluon. Here is the code:
   
   ```
   def get_vgg16(max):
       #net = nn.HybridSequential()
       net = nn.Sequential()
       with net.name_scope():
           # Block 1
           net.add(nn.Conv3D(64, kernel_size = 3, padding = 1, activation='relu'))
           net.add(nn.Conv3D(64, kernel_size = 3, padding = 1, activation='relu'))
           net.add(nn.MaxPool3D(pool_size=(2, 2, 2), strides = (2, 2, 2)))
           # Block 2
           net.add(nn.Conv3D(128, kernel_size = 3, padding = 1, activation='relu'))
           net.add(nn.Conv3D(128, kernel_size = 3, padding = 1, activation='relu'))
           net.add(nn.MaxPool3D(pool_size=(2, 2, 2), strides = (2, 2, 2)))
           # Block 3
           net.add(nn.Conv3D(256, kernel_size = 3, padding = 1, activation='relu'))
           net.add(nn.Conv3D(256, kernel_size = 3, padding = 1, activation='relu'))
           net.add(nn.Conv3D(256, kernel_size = 3, padding = 1, activation='relu'))
           net.add(nn.MaxPool3D(pool_size=(2, 2, 2), strides = (2, 2, 2)))
           # Block 4
           net.add(nn.Conv3D(512, kernel_size = 3, padding = 1, activation='relu'))
           net.add(nn.Conv3D(512, kernel_size = 3, padding = 1, activation='relu'))
           net.add(nn.Conv3D(512, kernel_size = 3, padding = 1, activation='relu'))
           net.add(nn.MaxPool3D(pool_size=(2, 2, 2), strides = (2, 2, 2)))
           # Block 5
           net.add(nn.Conv3D(512, kernel_size = 3, padding = 1, activation='relu'))
           net.add(nn.Conv3D(512, kernel_size = 3, padding = 1, activation='relu'))
           # Block 6
           net.add(nn.Conv3DTranspose(512, kernel_size = 4, strides = (4, 4, 4), activation='relu'))
           # Block 7
           net.add(nn.Conv3D(256, kernel_size = 3, padding = 1, activation='relu'))
           net.add(nn.Conv3D(4096, kernel_size = 1, padding = 0, activation='relu'))
           net.add(nn.Conv3D(4096, kernel_size = 1, padding = 0, activation='relu'))
           net.add(nn.Conv3D(max, kernel_size = 1, activation='sigmoid'))
           return net
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services