d1dfcc0b80c4ecead8866473e5cfdfd351ac7cbd,kur/backend/keras_backend.py,KerasBackend,process_loss,#KerasBackend#Any#Any#,530

Before Change


		if isinstance(loss, Loss):
			loss = [loss]

		if len(loss) != len(model.outputs):
			raise ValueError("Model has {} outputs, but only {} loss "
				"functions were specified."
				.format(len(model.outputs), len(loss)))

		if isinstance(loss, (list, tuple)):
			loss = dict(zip(model.outputs, loss))

		if not isinstance(loss, (dict, OrderedDict)):

After Change


		
		import keras.backend as K				// pylint: disable=import-error

		if not loss:
			num_outputs = len(model.outputs)
			logger.error("You are trying to construct a training/validation"
				"/testing model, but you haven\"t specified any loss "
				"functions. Your model has %d outputs: %s. You need to "
				"specify %d loss functions, one for each output.",
				num_outputs, ", ".join(model.outputs), num_outputs)
			raise ValueError("No loss functions were specified, but are "
				"required for training, testing, and validation.")

		if isinstance(loss, Loss):
			loss = [loss]

		output_only = set(model.outputs) - set(loss)
		if output_only:
			logger.debug("These layers will be output-only layers, without "
				"loss functions attached: %s", ", ".join(output_only))

		if isinstance(loss, (list, tuple)):
			loss = {x.get("target") : x for x in loss}

		if not isinstance(loss, (dict, OrderedDict)):
			raise ValueError("Loss functions given to "compile" should be "
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: deepgram/kur
Commit Name: d1dfcc0b80c4ecead8866473e5cfdfd351ac7cbd
Time: 2017-05-10
Author: ajsyp@syptech.net
File Name: kur/backend/keras_backend.py
Class Name: KerasBackend
Method Name: process_loss


Project Name: deepgram/kur
Commit Name: d1dfcc0b80c4ecead8866473e5cfdfd351ac7cbd
Time: 2017-05-10
Author: ajsyp@syptech.net
File Name: kur/backend/pytorch_backend.py
Class Name: PyTorchBackend
Method Name: process_loss


Project Name: stanford-mast/nn_dataflow
Commit Name: ef4353bd24b9d781c2dfa9cd2146d9b87e63b6f1
Time: 2017-05-01
Author: mgao12@stanford.edu
File Name: nn_dataflow/Scheduling.py
Class Name: Scheduling
Method Name: schedule_search