Skip to content

Instantly share code, notes, and snippets.

@arunm8489
Created June 3, 2020 14:35
Show Gist options
  • Save arunm8489/3b5aaf6434ee0991dd2d8b6c22f8f3ae to your computer and use it in GitHub Desktop.
Save arunm8489/3b5aaf6434ee0991dd2d8b6c22f8f3ae to your computer and use it in GitHub Desktop.
elif (block["type"] == 'route'):
# start and end is given in format (eg:-1 36 so we will find layer number from it.
# we will find layer number in negative format
# so that we can get the number of filters in that layer
block['layers'] = block['layers'].split(',')
start = int(block['layers'][0])
if len(block['layers']) == 1:
#ie if -1 given and present layer is 20 . we have to sum filters in 19th and 20th layer
block['layers'][0] = int(i + start)
filters = output_filters[block['layers'][0]] #start layer number
elif len(block['layers']) > 1:
# suppose we have -1,28 and present layer is 20 we have sum filters in 19th and 28th layer
block['layers'][0] = int(i + start)
# block['layers'][1] = int(block['layers'][1]) - i # end layer number
block['layers'][1] = int(block['layers'][1])
filters = output_filters[block['layers'][0]] + output_filters[block['layers'][1]]
# that means this layer don't have any forward operation
route = DummyLayer()
seq.add_module("route_{0}".format(i),route)
elif block["type"] == "shortcut":
from_ = int(block["from"])
shortcut = DummyLayer()
seq.add_module("shortcut_{0}".format(i),shortcut)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment