class_docstr: NMTModel Class
  See :class:`~onmt.models.BaseModel` for options.
class_docstr_tok: ["NMTModel","Class","See",":","class",":","`","~onmt.models.BaseModel","`","for","options","."]
docstr: Count number of parameters in model (& print with `log` callback).
  
  Returns:
      (int, int):
      * encoder side parameter count
      * decoder side parameter count
docstr_tok: ["Count","number","of","parameters","in","model","(","&","print","with","`","log","`","callback",")",".","Returns",":","(","int",",","int",")",":","*","encoder","side","parameter","count","*","decoder","side","parameter","count"]
code: def count_parameters(self, log=print):
      """Count number of parameters in model (& print with `log` callback).
  
      Returns:
          (int, int):
          * encoder side parameter count
          * decoder side parameter count"""
  
      enc, dec = 0, 0
      for name, param in self.named_parameters():
          if "encoder" in name:
              enc += param.nelement()
          else:
              dec += param.nelement()
      if callable(log):
          log("encoder: {}".format(enc))
          log("decoder: {}".format(dec))
          log("* number of parameters: {}".format(enc + dec))
      return enc, dec
  
imports: import torch
  import torch.nn
  from glob import glob
label_desc: Use image node_id 4 for calling the NMTModel obj's underlying member method code with example usage: obj.count_parameters(log) and returns: enc,  dec