Skip to content

Instantly share code, notes, and snippets.

View MTDzi's full-sized avatar

Maciej MTDzi

View GitHub Profile
@marta-sd
marta-sd / backward_hook.py
Created November 19, 2022 12:57
Example of using backward hooks
import torch
from torch import nn
class Net(nn.Module):
def __init__(self):
super().__init__()
self.l1 = nn.Sequential(nn.Linear(8, 64), nn.ReLU(), nn.Linear(64, 2))
self.l2 = nn.Sequential(nn.Linear(64, 64), nn.ReLU(), nn.Linear(64, 2))
self.relu = nn.ReLU()
def forward(self, x, y):
@dlaz
dlaz / python_pointclouds.py
Created April 30, 2014 19:18
deserialize point clouds in python
#!/usr/bin/env python
from sensor_msgs.msg import PointCloud2, PointField
import numpy as np
import struct
fmt_full = ''
_DATATYPES = {}
_DATATYPES[PointField.INT8] = ('b', 1)
_DATATYPES[PointField.UINT8] = ('B', 1)