bc6c691202e5f8755de7b13d88f86286ff878abb,kur/backend/pytorch_backend.py,PyTorchBackend,process_loss,#PyTorchBackend#Any#Any#,244

Before Change


				"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 "

After Change


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

		if isinstance(loss, (list, tuple)):
			loss_with_names = []
			for x in loss:
				if not isinstance(x, (dict, OrderedDict)):
					raise ValueError("Expected each individual loss entry to "
						"be a dictionary. Received: {}".format(x))
				if not "target" in x:
					raise ValueError("Missing required key in loss function: "
						""target".")
				loss_with_names.append((x["target"], x))

		elif isinstance(loss, (dict, OrderedDict)):
			loss_with_names = list(loss.items())

		else:
			raise ValueError("Loss functions given to "compile" should be "
				"a list/tuple, a dictionary, or a single Loss instance. "
				"Instead we received this: {} (type={})"
				.format(loss, type(loss)))

		return OrderedDict(
			(
				target,
				this_loss.get_loss(model, target, model.outputs[target].value)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


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


Project Name: dask/dask-ml
Commit Name: 0f26eb47f14e747a4dc55c81b2c440688cde2d64
Time: 2019-06-26
Author: stsievert@users.noreply.github.com
File Name: dask_ml/model_selection/_incremental.py
Class Name: IncrementalSearchCV
Method Name: _additional_calls


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