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 itertools | |
| def summed_permutations(matrix): | |
| columnwise_sum = torch.sum(matrix, dim=1) | |
| length = int(columnwise_sum.shape[0]) | |
| result = torch.cat([ | |
| torch.index_select(columnwise_sum, dim=0, index=torch.LongTensor(each)) |
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 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
| def shape_list(x): | |
| """ | |
| deal with dynamic shape in tensorflow cleanly | |
| """ | |
| ps = x.get_shape().as_list() | |
| ts = tf.shape(x) | |
| return [ts[i] if ps[i] is None else ps[i] for i in range(len(ps))] |
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
| (setv train_loader (torch.utils.data.DataLoader | |
| (datasets.MNIST "./data" :train True :download True | |
| :transform (transforms.Compose (list | |
| ((transforms.ToTensor) | |
| (transforms.Normalize :std 0.1307 :mean 0.3081)) | |
| ))))) |
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
| self.input_weight_offset = 0 | |
| self.input_weight_slice = slice(self.input_weight_offset, self.activation_hidden_size) | |
| self.input_weight_view = (self.activation_hidden_size, 1) | |
| self.input_slice_offset = self.input_weight_offset + \ | |
| self.slice_size(self.input_weight_slice) | |
| self.input_bias_slice = slice(self.input_slice_offset, | |
| self.input_slice_offset + self.activation_hidden_size) | |
| self.input_bias_view = (self.activation_hidden_size) |
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 re | |
| import os | |
| import glob | |
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| from collections import OrderedDict | |
| fig_size = [12, 9] |
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.utils.model_zoo as model_zoo | |
| from torchvision.models.resnet import BasicBlock, Bottleneck, ResNet | |
| model_urls = { | |
| 'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth', | |
| 'resnet34': 'https://download.pytorch.org/models/resnet34-333f7ec4.pth', | |
| 'resnet50': 'https://download.pytorch.org/models/resnet50-19c8e357.pth', | |
| 'resnet101': 'https://download.pytorch.org/models/resnet101-5d3b4d8f.pth', |
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 cv2 | |
| import rospy | |
| import numpy as np | |
| from cv_bridge import CvBridge | |
| from sensor_msgs.msg import CompressedImage, Image | |
| class ImageLoader(object): |
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
| ERROR: the following packages/stacks could not have their rosdep keys resolved | |
| to system dependencies: | |
| tf2_kdl: No definition of [eigen] for OS version [] | |
| message_filters: No definition of [boost] for OS version [] | |
| robot_state_publisher: No definition of [eigen] for OS version [] | |
| python_qt_binding: No definition of [python-qt5-bindings] for OS version [] | |
| rospack: No definition of [boost] for OS version [] | |
| opencv3: No definition of [protobuf] for OS version [] | |
| eigen_conversions: No definition of [eigen] for OS version [] | |
| rostest: No definition of [boost] for OS version [] |
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
| Traceback (most recent call last): | |
| File "main.py", line 173, in <module> | |
| train() | |
| File "main.py", line 140, in train | |
| output, hidden = model(data, hidden) | |
| File "/home/conner/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 225, in __call__ | |
| result = self.forward(*input, **kwargs) | |
| File "/home/conner/programming/learned_activations/experiments/word_language_model/model.py", line 57, in forward | |
| output, hidden = self.rnn(emb, hidden) | |
| File "/home/conner/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 225, in __call__ |
NewerOlder