def parse(self, name, mcp, prev_layers, model): dic = CostParser.parse(self, name, mcp, prev_layers, model) if dic['numInputs'][0] != 1: # first input must be labels raise LayerParsingError("Layer '%s': dimensionality of first input must be 1" % name) dic['channels'] = mcp.safe_get_int(name, 'channels') dic['imgSize'] = mcp.safe_get_int(name, 'imgSize') print "Initialized groupSparsityInLabel cost '%s' with %d channels and %dx%d inputs" % (name, dic['channels'], dic['imgSize'], dic['imgSize']) return dic
def parse(self, name, mcp, prev_layers, model): dic = CostParser.parse(self, name, mcp, prev_layers, model) if dic['numInputs'][0] != 1: # first input must be labels raise LayerParsingError( "Layer '%s': dimensionality of first input must be 1" % name) dic['channels'] = mcp.safe_get_int(name, 'channels') dic['imgSize'] = mcp.safe_get_int(name, 'imgSize') print "Initialized groupSparsityInLabel cost '%s' with %d channels and %dx%d inputs" % ( name, dic['channels'], dic['imgSize'], dic['imgSize']) return dic
def __init__(self): CostParser.__init__(self, num_inputs=2)