This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyModel(tf.keras.Model): | |
def __init__(self, keep_probability=0.2): | |
super(MyModel, self).__init__() | |
self.dense1 = tf.keras.layers.Dense(4) | |
self.dense2 = tf.keras.layers.Dense(5) | |
self.keep_probability = keep_probability | |
@tf.function | |
def call(self, inputs, training=True): | |
y = self.dense2(self.dense1(inputs)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def tf__helper(self, inputs): | |
do_return = False | |
retval_ = ag__.UndefinedReturnValue() | |
inputs = ag__.converted_call('transpose', tf, ag__.ConversionOptions(recursive=True, force_conversion=False, optional_features=(), internal_convert_user_code=True), (inputs, [1, 0, 2]), None) | |
batch_size = ag__.converted_call('shape', tf, ag__.ConversionOptions(recursive=True, force_conversion=False, optional_features=(), internal_convert_user_code=True), (inputs,), None)[1] | |
hidden = ag__.converted_call('zeros', tf, ag__.ConversionOptions(recursive=True, force_conversion=False, optional_features=(), internal_convert_user_code=True), ([batch_size, hidden_size],), {'name': 'hidden'}) | |
output = ag__.converted_call('zeros', tf, ag__.ConversionOptions(recursive=True, force_conversion=False, optional_features=(), internal_convert_user_code=True), ([batch_size, output_size],), {'name': 'output'}) | |
def loop_body(loop_vars, hidden_1, output_1): | |
x_t = loop_vars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from torch.utils.data import Dataset, DataLoader | |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu") | |
class CSVDataset(Dataset): | |
def __init__(self, x, y): | |
self.data = torch.tensor(x, dtype=torch.float, device=device) | |
self.target = torch.tensor(y, dtype=torch.long, device=device) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def solve_specific(line: str): | |
matched = re.match(r'\[(.*)\]\[(.*?)\]', line) | |
name = matched.group(1) | |
label = matched.group(2) | |
return '\n'.join(list(map(lambda x: '{} B-{}'.format(x[1], label) if x[0] == 0 else '{} I-{}'.format(x[1], label), enumerate(name)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hbase(main):003:0> put 'alarm_mmdd','imeiTSE','r:stat','stat' | |
0 row(s) in 0.1400 seconds | |
hbase(main):004:0> put 'alarm_mmdd','imeiTSE','r:type','type' | |
0 row(s) in 0.0060 seconds | |
hbase(main):005:0> put 'alarm_mmdd','imeiTSE','r:viewed','viewed' | |
0 row(s) in 0.0020 seconds | |
hbase(main):006:0> put 'alarm_mmdd','imeiTSE','r:record','record' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http.client | |
import urllib.request | |
import urllib.parse | |
import urllib.error | |
import base64 | |
import json | |
sub_key = "ba0747d02f2a42ffbc0f0dd2cb1fba06" | |
KBID = "b49a4b5a-8a4e-4feb-9caa-604ea9a6ba82" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from PyPDF2 import PdfFileMerger | |
PDFMerger = PdfFileMerger() | |
filePathList = sys.argv[1:] | |
for filePath in filePathList: | |
PDFMerger.append(filePath) | |
with open("Report.pdf", "wb") as output: | |
PDFMerger.write(output) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from string import Template | |
with open("template.md", 'r') as file: | |
templateFile = file.read() | |
with open("main.c", 'r') as file: | |
code = file.read() | |
template = Template(templateFile) | |
print(template.safe_substitute(code=code)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
for i in range(1,10): | |
dir_name = str(i) | |
os.mkdir(dir_name) | |
os.chdir(dir_name) | |
open("question", 'a').close() | |
open("input", 'a').close() | |
open("output", 'a').close() | |
open("whatsup", 'a').close() | |
os.mkdir("code") |