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/05/17 18:19:57 UTC

[GitHub] szha commented on a change in pull request #10989: [WIP] add gluon model summary

szha commented on a change in pull request #10989: [WIP] add gluon model summary
URL: https://github.com/apache/incubator-mxnet/pull/10989#discussion_r189055069
 
 

 ##########
 File path: python/mxnet/gluon/block.py
 ##########
 @@ -355,14 +357,68 @@ def load_params(self, filename, ctx=None, allow_missing=False,
                         name, filename, _brief_print_list(self._params.keys())))
             params[name]._load_init(loaded[name], ctx)
 
-
     def register_child(self, block, name=None):
         """Registers block as a child of self. :py:class:`Block` s assigned to self as
         attributes will be registered automatically."""
         if name is None:
             name = str(len(self._children))
         self._children[name] = block
 
+    def register_forward_pre_hook(self, hook):
+        r"""Registers a forward pre-hook on the block.
+
+        The hook function is called immediately before :func:`forward`.
+        It should not modify the input or output.
+
+        Parameters
+        ----------
+        hook : callable
+            The forward hook function of form `hook(block, input) -> None`.
+
+        Returns
+        -------
+        :class:`mxnet.gluon.utils.RemovableHandle`
+        """
+        handle = RemovableHandle(self._forward_pre_hooks)
 
 Review comment:
   OK

----------------------------------------------------------------
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