fc94cf593f218f4c3e715d8a2d58b324c2828007,VAEs/vq-vae/trainers/train_prior.py,TrainerPrior,forward_pass,#TrainerPrior#Any#Any#,83

Before Change


	def forward_pass(self, img_var, labels):
		enc_indices, quantized = self.base_model(img_var, return_encoding_indices=True, test=True)
		labels_var = nn.Variable(labels.shape)
		if isinstance(labels, nn.NdArray):
			labels_var.data  = labels
		else:
			labels_var.d = labels
		labels_var = F.one_hot(labels_var, shape=(self.num_classes,))
		enc_recon = self.prior(quantized, labels_var)
		loss = F.mean(F.softmax_cross_entropy(enc_recon, enc_indices))

After Change


	def forward_pass(self, img_var, labels):
		enc_indices, quantized = self.base_model(img_var, return_encoding_indices=True)

		if self.dataset_name == "imagenet":
			labels = nn.Variable(labels.shape).apply(data=labels)
		else:
			labels = nn.Variable.from_numpy_array(labels)
		labels = F.one_hot(labels, shape=(self.num_classes,))
		enc_recon = self.prior(quantized, labels)
		loss = F.mean(F.softmax_cross_entropy(enc_recon, enc_indices))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 11

Instances


Project Name: sony/nnabla-examples
Commit Name: fc94cf593f218f4c3e715d8a2d58b324c2828007
Time: 2020-11-06
Author: Krishna.Wadhwani@sony.com
File Name: VAEs/vq-vae/trainers/train_prior.py
Class Name: TrainerPrior
Method Name: forward_pass


Project Name: keras-team/keras
Commit Name: ecbf73f72b59f8f5c8746de63270aa1fb3ad7524
Time: 2018-10-01
Author: gabrieldemarmiesse@gmail.com
File Name: keras/callbacks.py
Class Name: TensorBoard
Method Name: on_epoch_end


Project Name: home-assistant/home-assistant
Commit Name: e3307fb1c2eaf4ff05da8676d71d29b0500b312b
Time: 2017-05-23
Author: bernd@bjws.nl
File Name: homeassistant/components/sensor/hp_ilo.py
Class Name: HpIloSensor
Method Name: update