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 "
				"a list/tuple, a dictionary, or a single Loss instance. "

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: dpressel/mead-baseline
Commit Name: 19d2bbc7d6e70836f34b83ac7702a0477e4b97b0
Time: 2019-11-19
Author: blester125@gmail.com
File Name: python/baseline/tf/seq2seq/decoders/v1.py
Class Name: TransformerDecoder
Method Name: __init__


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