Skip to content

Instantly share code, notes, and snippets.

View Shashi456's full-sized avatar

Pawan Sasanka Ammanamanchi Shashi456

View GitHub Profile
@Shashi456
Shashi456 / clean.py
Created July 4, 2021 04:11
Hindi Cleaning script
import re
import json
# Base Path
BASE_PATH = f"/hin-electra"
# The path to the local git repo for Indic NLP library
INDIC_NLP_LIB_HOME = f"{BASE_PATH}/lib/indic_nlp_library"
# The path to the local git repo for Indic NLP Resources
INDIC_NLP_RESOURCES = f"{BASE_PATH}/lib/indic_nlp_resources"
# All indic nlp lib path to system path

Keybase proof

I hereby claim:

  • I am shashi456 on github.
  • I am pawsed (https://keybase.io/pawsed) on keybase.
  • I have a public key ASC0-8VrtCFfLCNLww9QL83kCqR9WehKdowqkskeqcH0SAo

To claim this, I am signing this object:

class GramMatrix(nn.Module):
def forward(self, input):
b, c, h, w = input.size()
f = input.view(b, c, h*w) #bxcx(hxw)
# torch.bmm(batch1, batch2, out=None)
# batch1 : bxmxp, batch2 : bxpxn -> bxmxn
G = torch.bmm(f, f.transpose(1, 2)) # f: bxcx(hxw), f.transpose: bx(hxw)xc -> bxcxc
return G.div_(h*w)