The code for class MLP is mistakingly applying the actuation function to the last (i.e. output) layer. The error is in the evaluation of the is_last flag. The current code is:
class MLP(nn.Module):
def __init__(self, dims, act = None):
super().__init__()
dims_pairs = list(zip(dims[:-1], dims[1:]))
layers = []
for ind, (dim_in, dim_out) in enumerate(dims_pairs):
is_last = ind >= (len(dims) - 1)
The last line should be changed to is_last = ind >= (len(dims) - 2):
class MLP(nn.Module):
def __init__(self, dims, act = None):
super().__init__()
dims_pairs = list(zip(dims[:-1], dims[1:]))
layers = []
for ind, (dim_in, dim_out) in enumerate(dims_pairs):
is_last = ind >= (len(dims) - 2)
The code for class MLP is mistakingly applying the actuation function to the last (i.e. output) layer. The error is in the evaluation of the
is_last
flag. The current code is:The last line should be changed to
is_last = ind >= (len(dims) - 2)
:If you like, I can do a pull request.