class_docstr: Make continuous embeddings and boost learning rate
  
  Args:
      num_embeddings (int): number of embeddings
      embedding_dim (int): embedding dimensions
      scale (float, optional): amount to scale learning rate (Default: 10.0)
      smooth (bool, optional): choose to apply smoothing (Default: ``False``)
class_docstr_tok: ["Make","continuous","embeddings","and","boost","learning","rate","Args",":","num_embeddings","(","int",")",":","number","of","embeddings","embedding_dim","(","int",")",":","embedding","dimensions","scale","(","float",",","optional",")",":","amount","to","scale","learning","rate","(","Default",":","10.0",")","smooth","(","bool",",","optional",")",":","choose","to","apply","smoothing","(","Default",":","``","False","``",")"]
code: def __init__(
      self,
      num_embeddings: int,
      embedding_dim: int,
      scale: float = 10.0,
      smooth: bool = False,
  ):
      super().__init__()
      self.embedding = nn.Embedding(num_embeddings, embedding_dim)
      if smooth:
          weight = torch.cumsum(self.embedding.weight.data, dim=0)
          # when summing gaussian, scale raises as sqrt(n), so we normalize by that.
          weight = (
              weight
              / torch.arange(1, num_embeddings + 1).sqrt()[:, None]
          )
          self.embedding.weight.data[:] = weight
      self.embedding.weight.data /= scale
      self.scale = scale
  
imports: import math
  import typing
  from typing import Any, Dict, List, Optional
  import torch
  from torch import nn
  from torch.nn import functional
label_desc: Use image node_id 1 to create a new _ScaledEmbedding object from inherited base classes: torch.nn with example: obj = _ScaledEmbedding(num_embeddings, embedding_dim, scale, smooth)