Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Give information about depth if present when printing Convolution layers #222

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions neon/layers/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,12 +602,23 @@ def __init__(self, fshape, strides={}, padding={}, init=None, bsum=False,
self.convparams.update(d)

def __str__(self):
return ("Convolution Layer '%s': %d x (%dx%d) inputs, %d x (%dx%d) "
"outputs, padding %d, stride %d" %
(self.name,
self.in_shape[0], self.in_shape[1], self.in_shape[2],
self.out_shape[0], self.out_shape[1], self.out_shape[2],
self.convparams['pad_h'], self.convparams['str_h']))
if len(self.in_shape) == 3:
ishape = "%d x (%dx%d)" % (self.in_shape[0], self.in_shape[1], self.in_shape[2])
pd = "%d,%d" % (self.convparams['pad_h'], self.convparams['pad_w'])
st = "%d,%d" % (self.convparams['str_h'], self.convparams['str_w'])
else:
ishape = "%d x (%dx%dx%d)" % (self.in_shape[0], self.in_shape[1], self.in_shape[2], self.in_shape[3])
pd = "%d,%d,%d" % (self.convparams['pad_d'], self.convparams['pad_h'], self.convparams['pad_w'])
st = "%d,%d,%d" % (self.convparams['str_d'], self.convparams['str_h'], self.convparams['str_w'])

if len(self.out_shape) == 3:
oshape = "%d x (%dx%d)" % (self.out_shape[0], self.out_shape[1], self.out_shape[2])
else:
oshape = "%d x (%dx%dx%d)" % (self.out_shape[0], self.out_shape[1], self.out_shape[2], self.out_shape[3])

return ("Convolution Layer '%s': %s inputs, %s "
"outputs, padding %s, stride %s" %
(self.name, ishape, oshape, pd, st))

def configure(self, in_obj):
super(Convolution, self).configure(in_obj)
Expand Down