This file contains hidden or 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 collections import OrderedDict | |
| def load_parallel(model, state_dict): | |
| new_state_dict = OrderedDict() | |
| for k, v in state_dict.items(): | |
| name = k[7:] | |
| new_state_dict[name] = v | |
| model.load_state_dict(new_state_dict) | |
| return model |
This file contains hidden or 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 diff_match_patch | |
| paper_a_path = 'a.tex' | |
| paper_b_path = 'b.tex' | |
| a_data = None | |
| with open(icme_path, "r") as f: | |
| a_data = f.read() | |
| b_data = None |
This file contains hidden or 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 math | |
| import torch | |
| import numpy as np | |
| import pandas as pd | |
| import seaborn as sns | |
| import matplotlib.pyplot as plt | |
| from matplotlib import cm | |
| from matplotlib.lines import Line2D |
This file contains hidden or 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 torch | |
| import torch.nn | |
| import torch.nn.functional as F | |
| def one_hot_encode_truth(truth, num_class=4): | |
| # N, H, W --> N, C, H, W (C = num_class) | |
| one_hot = truth.repeat(1, num_class, 1, 1) | |
| arange = torch.arange(1, num_class + 1).view(1, num_class, 1, 1).to(truth.device) | |
| one_hot = (one_hot == arange).float() |
This file contains hidden or 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
| Sub ResizePlotArea() | |
| Dim iHeight, iWidth As Integer | |
| iTop = 40 | |
| iLeft = 0 | |
| iHeight = 180 | |
| iWidth = 280 | |
| ActiveChart.PlotArea.Select | |
| Selection.Top = iTop | |
| Selection.Left = iLeft |