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 matplotlib.pyplot as plt | |
import pandas as pd | |
import plotly.express as px | |
pd.options.plotting.backend = "plotly" | |
UTILIZATION = 0.1 | |
OP_UPFRONT_COST = 3300 | |
ELECTRICTY_COST_KWH = 0.13 |
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 | |
import matplotlib.pyplot as plt | |
import random | |
import time | |
# Size of dataset to be generated. The final size is 4 * data_size | |
data_size = 1000 | |
num_iters = 50 | |
num_clusters = 4 |
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 | |
import matplotlib.pyplot as plt | |
import random | |
import time | |
# Size of dataset to be generated. The final size is 4 * data_size | |
data_size = 1000 | |
num_iters = 50 | |
num_clusters = 4 |
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 | |
import matplotlib.pyplot as plt | |
import random | |
import time | |
# Size of dataset to be generated. The final size is 4 * data_size | |
data_size = 1000 | |
num_iters = 50 | |
num_clusters = 4 |
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 | |
from shutil import copy | |
import random | |
from tqdm import tqdm | |
partition_percentage = 90 | |
annotations_dir = 'GauGAN_Annotations' | |
annotations_files = os.listdir(annotations_dir) | |
annotations_files = [os.path.join(os.path.realpath("."), annotations_dir, x) for x in annotations_files] |
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 | |
import os | |
import cv2 | |
from copy import deepcopy | |
from matplotlib import pyplot as plt | |
from tqdm import tqdm | |
from shutil import copy | |
with open("label_colors.txt", "r") as file: | |
label_colors = file.read().split("\n")[:-1] |
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 | |
import os | |
import cv2 | |
from copy import deepcopy | |
from matplotlib import pyplot as plt | |
from tqdm import tqdm | |
from shutil import copy | |
with open("label_colors.txt", "r") as file: | |
label_colors = file.read().split("\n")[:-1] |
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
Gradient of L w.r.t to w1: -36.0 | |
Gradient of L w.r.t to w2: -28.0 | |
Gradient of L w.r.t to w3: -8.0 | |
Gradient of L w.r.t to w4: -20.0 | |
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 import FloatTensor | |
from torch.autograd import Variable | |
# Define the leaf nodes | |
a = Variable(FloatTensor([4])) | |
weights = [Variable(FloatTensor([i]), requires_grad=True) for i in (2, 5, 9, 7)] | |
# unpack the weights for nicer assignment |
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 torch | |
x = torch.Tensor(5, 4) | |
print(x) |