git config --global core.editor "vim"
if you want to set the editor for Git and also other programs, set the standardized VISUAL and EDITOR environment variables*:
export VISUAL=vim
export EDITOR="$VISUAL"
git config --global core.editor "vim"
if you want to set the editor for Git and also other programs, set the standardized VISUAL and EDITOR environment variables*:
export VISUAL=vim
export EDITOR="$VISUAL"
With Centos 7 I did the following to increase the default size of the containers | |
Modify the docker config in /etc/sysconfig/docker-storage to add the line: | |
DOCKER_STORAGE_OPTIONS= - -storage-opt dm.basesize=20G | |
service docker stop | |
rm /var/lib/docker NOTE THIS DELETES ALL IMAGES etc. SO MAKE A BACKUP | |
service docker start | |
docker load < [each_save_in_backup.tar] | |
docker run -i -t [imagename] /bin/bash |
try: | |
state_dict = model.module.state_dict() | |
except AttributeError: | |
state_dict = model.state_dict() |
#!/usr/bin/env python | |
# -*- coding:UTF-8 -*- | |
import torch | |
import torch.nn as nn | |
import torch.nn.init as init | |
def weight_init(m): | |
''' |
I have done below mentioned things and it started working. | |
vim ~/.ssh/config | |
Add these lines and save it. | |
Host github.com | |
Hostname ssh.github.com | |
Port 443 | |
Host bitbucket.org |
from functools import wraps | |
import errno | |
import os | |
import signal | |
class TimeoutError(Exception): | |
pass | |
import torch | |
A = torch.randn([12, 9, 64]) | |
B = torch.randn([12, 9, 64]) | |
Ar = A.repeat(1, 1, 9).view(12, 81, 64) | |
Br = B.repeat(1, 9, 1) | |
C = torch.cat((Ar, Br), dim=2) | |
D = torch.cat([A.unsqueeze(2).expand(-1, -1, 9, -1), | |
B.unsqueeze(1).expand(-1, 9, -1, -1)], dim=-1).view(12, 81, 128) | |
print ((C-D).abs().max().item()) # should be 0 |
import os | |
from collections import namedtuple | |
from ast import literal_eval | |
from os.path import dirname | |
export_path = "path/to/export" | |
# Read & Write using native python | |
# write tsv | |
os.makedirs(dirname(export_path), exist_ok=True) |
Reference : xorho, https://stackoverflow.com/questions/2043453/executing-multi-line-statements-in-the-one-line-command-line | |
80 | |
this style can be used in makefiles too (and in fact it is used quite often). | |
python - <<EOF | |
import sys | |
for r in range(3): print 'rob' | |
EOF |