Skip to content

Instantly share code, notes, and snippets.

@zhreshold
Created October 4, 2017 18:57
Show Gist options
  • Save zhreshold/d3104e77e7f8f90931ea058e1d64c917 to your computer and use it in GitHub Desktop.
Save zhreshold/d3104e77e7f8f90931ea058e1d64c917 to your computer and use it in GitHub Desktop.
HybridBlock of concat layer
from mxnet.gluon import HybridBlock
class Concat(HybridBlock):
"""Concat operation for multiple inputs."""
def __init__(self, dim=1, **kwargs):
super(Concat, self).__init__(**kwargs)
self._kwargs = {'dim': dim}
def hybrid_forward(self, F, *args):
return F.concat(*args, name='fwd', **self._kwargs)
def __repr__(self):
s = '{name}(dim={dim})'
return s.format(name=self.__class__.__name__, **self._kwargs)
@pribadihcr
Copy link

How to use this block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment