Skip to content

Instantly share code, notes, and snippets.

@dmklee
dmklee / easy_pybullet_camera_placement.py
Last active October 11, 2024 09:48
Interactive Method for Placing Camera in Pybullet Simulation
import numpy as np
import matplotlib.pyplot as plt
import pybullet as pb
import pybullet_data
def read_parameters(dbg_params):
'''Reads values from debug parameters
Parameters
----------
@jeasinema
jeasinema / weight_init.py
Last active November 22, 2024 07:17
A simple script for parameter initialization for PyTorch
#!/usr/bin/env python
# -*- coding:UTF-8 -*-
import torch
import torch.nn as nn
import torch.nn.init as init
def weight_init(m):
'''
@kaniblu
kaniblu / rnn_init.py
Created October 26, 2017 05:14
PyTorch LSTM and GRU Orthogonal Initialization and Positive Bias
def init_gru(cell, gain=1):
cell.reset_parameters()
# orthogonal initialization of recurrent weights
for _, hh, _, _ in cell.all_weights:
for i in range(0, hh.size(0), cell.hidden_size):
I.orthogonal(hh[i:i + cell.hidden_size], gain=gain)
def init_lstm(cell, gain=1):