MCPcopy Create free account
hub / github.com/BorealisAI/scaleformer / abs

Method abs

layers/utils.py:384–398  ·  view source on GitHub ↗
(self, x, y)

Source from the content-addressed store, hash-verified

382 self.size_average = size_average
383
384 def abs(self, x, y):
385 num_examples = x.size()[0]
386
387 # Assume uniform mesh
388 h = 1.0 / (x.size()[1] - 1.0)
389
390 all_norms = (h**(self.d/self.p))*torch.norm(x.view(num_examples,-1) - y.view(num_examples,-1), self.p, 1)
391
392 if self.reduction:
393 if self.size_average:
394 return torch.mean(all_norms)
395 else:
396 return torch.sum(all_norms)
397
398 return all_norms
399
400 def rel(self, x, y):
401 num_examples = x.size()[0]

Callers 12

MAEFunction · 0.80
MAPEFunction · 0.80
visualizeFunction · 0.80
lossfunFunction · 0.80
students_t_nllFunction · 0.80
partition_spline_curveFunction · 0.80
__init__Method · 0.80
__init__Method · 0.80
get_phi_psiFunction · 0.80
get_filterFunction · 0.80
laplace_crpsMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected