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 numpy as np | |
class Add: | |
def __init__(self): | |
pass | |
def forward(self, numlist): | |
self.numlist = numlist | |
return np.sum(numlist) | |
def backward(self, loss): | |
self.dnumlist = loss * np.ones(len(self.numlist)) |
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 numpy | |
class DatasetNoLabel(object): | |
def __init__(self, data): | |
self._data = data | |
self._num_examples = data.shape[0] | |
self._epochs_completed = 0 | |
self._index_in_epoch = 0 | |
@property | |
def data(self): | |
return self._data |
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
x = tf.placeholder(.....) | |
# Scope: 運算區塊 | |
with tf.name_scope("operation_scope"): | |
weight = ... | |
l1 = op(x, w) | |
... | |
... | |
tf.summary.histogram("weight", weight) # 可以看 weight 值的分佈,只是我還不清楚分佈是指什麼 | |
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 YourDataset(torch.utils.data.Dataset): | |
def __init__(self, ...): | |
... | |
def __len__(self): | |
... | |
return num_all_examples | |
def __getitem__(self, idx): | |
... |
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 | |
import json | |
import subprocess | |
import numpy as np | |
import pandas as pd | |
from skimage.measure import find_contours | |
class CocoDatasetHandler: | |
def __init__(self, jsonpath, imgpath): |
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
[[runners]] | |
pre_build_script = "mkdir -p $HOME/.docker/ && echo \"{ \\\"proxies\\\": { \\\"default\\\": { \\\"httpProxy\\\": \\\"$HTTP_PROXY\\\", \\\"httpsProxy\\\": \\\"$HTTPS_PROXY\\\", \\\"noProxy\\\": \\\"$NO_PROXY\\\" } } }\" > $HOME/.docker/config.json" | |
pre_clone_script = "git config --global http.proxy $HTTP_PROXY; git config --global https.proxy $HTTPS_PROXY" | |
environment = ["https_proxy=http://docker0_interface_ip:3128", "http_proxy=http://docker0_interface_ip:3128", "HTTPS_PROXY=docker0_interface_ip:3128", "HTTP_PROXY=docker0_interface_ip:3128"] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 pascal(n): | |
L = n + n - 1 | |
rows = [] | |
row = [1] | |
rows.append(row) | |
while len(rows) < n: | |
row_cat = [0] + row + [0] | |
row = [row_cat[i] + row_cat[i+1] for i in range(len(row_cat)-1)] | |
rows.append(row) | |
for row_idx, row in enumerate(rows): |
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 | |
import glob | |
import sys | |
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QPushButton, QListWidget, QHBoxLayout, QFileDialog | |
def compare_folders(dir1, dir2): | |
files_in_dir1 = [ | |
f.replace('._', '').replace(dir1 + '/', '') | |
for f in glob.glob(dir1 + '/**/*', recursive=True) |