class_docstr: N3 regularizer described in https://arxiv.org/pdf/1806.07297.pdf
class_docstr_tok: ["N3","regularizer","described","in","https",":","\/\/arxiv.org\/pdf\/1806.07297.pdf"]
code: def reg_embs(
      self, src_pos: FloatTensorType, dst_pos: FloatTensorType
  ) -> FloatTensorType:
      a, b, rank = torchbiggraph.model.match_shape(src_pos, -1, -1, -1)
      torchbiggraph.model.match_shape(dst_pos, a, b, rank)
      total = 0
      for x in (src_pos, dst_pos):
          total += torch.sum(self.modulus(x, rank // 2) ** 3)
      return total * self.weight
  
file_path: PyTorch-BigGraph/torchbiggraph/regularizers.py
imports: from abc import ABC, abstractmethod
  from typing import Optional
  import torch
  import torchbiggraph.model
  from torchbiggraph.operators import AbstractDynamicOperator, AbstractOperator
  from torchbiggraph.plugin import PluginRegistry
  from torchbiggraph.types import FloatTensorType, LongTensorType
label_desc: Use image node_id 1 for calling the N3Regularizer obj's underlying member method code with example usage: obj.reg_embs(src_pos, dst_pos) and returns: unknown