Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Second solution in Creative category for Is Even by _Chico_
def is_even(num: int) -> bool:
# your code here
if num %2== 0:
return True
return False
def aggregate_output(self):
"""Given a list of predictions from net, make a decision based on aggreagation rule"""
if isinstance(self.predictions, collections.Sequence):
logits = []
for pred in self.predictions:
logit = self.net.apply_argmax_softmax(pred).unsqueeze(0)
logits.append(logit)
logits = torch.cat(logits, 0)
if self.aggregation == 'max':
self.pred = logits.data.max(0)[0].max(1)
elif self.aggregation == 'mean':
self.pred = logits.data.mean(0).max(1)
elif self.aggregation == 'weighted_mean':
self.pred = (self.aggregation_weight.expand_as(logits) * logits).data.mean(0).max(1)
elif self.aggregation == 'idx':
self.pred = logits[self.aggregation_param].data.max(1)
else:
# Apply a softmax and return a segmentation map
self.logits = self.net.apply_argmax_softmax(self.predictions)
self.pred = self.logits.data.max(1)
May 21, 2021
Comments: