<s> import argparse <EOL> import numpy as np <EOL> import os <EOL> import glob <EOL> parser = argparse . ArgumentParser ( description = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , metavar = '<STR_LIT>' , help = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , metavar = '<STR_LIT>' , help = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , metavar = '<STR_LIT>' , help = '<STR_LIT>' ) <EOL> args = parser . parse_args ( ) <EOL> paths = glob . glob ( args . input_data ) <EOL> for path in paths : <EOL> print '<STR_LIT>' , path <EOL> with open ( path ) as fin : <EOL> x = np . load ( fin ) <EOL> x_tmp = np . zeros ( ( x . shape [ <NUM_LIT:0> ] , int ( args . dim ) ) ) <EOL> for i in xrange ( x . shape [ <NUM_LIT:0> ] ) : <EOL> x_tmp [ i , x [ i ] ] = <NUM_LIT:1> <EOL> base = os . path . basename ( path ) <EOL> print '<STR_LIT>' , "<STR_LIT>" % ( args . save_dir , base ) <EOL> with open ( "<STR_LIT>" % ( args . save_dir , base ) , '<STR_LIT:wb>' ) as fout : <EOL> np . save ( fout , np . asarray ( x_tmp ) ) <EOL> print <EOL> print '<STR_LIT>' </s>
