Skip to content

Commit

Permalink
Prevent creation of loss on empty network.
Browse files Browse the repository at this point in the history
  • Loading branch information
Leif Johnson committed Aug 31, 2015
1 parent db1240e commit 2fd28be
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions theanets/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,11 @@ def __init__(self, layers, loss='mse', weighted=False):
logging.info('network has %d total parameters', self.num_params)

self.losses = []
self.set_loss(loss,
weighted=weighted,
target=self.INPUT_NDIM,
output_name=self.layers[-1].output_name())
if loss and self.layers:
self.set_loss(loss,
weighted=weighted,
target=self.INPUT_NDIM,
output_name=self.layers[-1].output_name())

def add_layer(self, layer=None, is_output=False, **kwargs):
'''Add a layer to our network graph.
Expand Down

0 comments on commit 2fd28be

Please sign in to comment.