Skip to content

Instantly share code, notes, and snippets.

View Coderx7's full-sized avatar
💭
In God we Trust!

Seyyed Hossein Hasanpour Coderx7

💭
In God we Trust!
  • IRAN
  • 18:36 (UTC +03:30)
View GitHub Profile
#!/usr/bin/env python
#ROS Node to convert a GPS waypoint published on the topic "waypoint" into a 2D Navigation Goal in SLAM to achieve autonomous navigation to a GPS Waypoint
#Converts Decimal GPS Coordinates of waypoint to ROS Position Vector relative to the current gps position of the robot
#Accounts for curvature of the earth using haversine formula
#Depends rospy, std_msgs, geographic_msgs, sensor_msgs, numpy
#Written by Alex McClung, 2015, alex.mcclung@hotmail.com, To be Released Open Source under Creative Commons Attribution Share-Alike Licence
import roslib
import rospy
@Coderx7
Coderx7 / pytorch_cpu_perf_bkm.md
Created June 9, 2020 02:15 — forked from mingfeima/pytorch_cpu_perf_bkm.md
BKM for PyTorch CPU Performance

General guidelines for CPU performance on PyTorch

This file serves a BKM to get better performance on CPU for PyTorch, mostly focusing on inference or deployment. Chinese version available here.

1. Use mkldnn layout

layout refers to how data is organized in a tensor. PyTorch default layout is NCHW, from optimization perspective, MKL-DNN library (renamed as DNNL recently) may choose a different layout, sometimes refered to as internal layout or primitive layout. This is actually a normal technique for acceleration libraries, common knowledge is that NHWC runs faster than NCHW for convolution, changing the default NCHW to NHWC is called a reorder. MKL-DNN may choose different internal layouts based on the input pattern and the algorithm selected, e.g. nChw16c, a.k.a. reorder a 4-dim tensor into 5-dim by chop down dimension C by 16, for vectorization purpose (AVX512 instruction length is 16x32 bit).

By default on CPU, conv2d will ru

@Coderx7
Coderx7 / main.go
Created April 21, 2020 11:07 — forked from KatelynHaworth/main.go
Example of run an interactive process on the current user from system service on windows (Golang)
package main
import (
"github.com/kardianos/service"
"log"
"flag"
)
type Service struct {}
@Coderx7
Coderx7 / embpython.c
Created April 20, 2020 07:48 — forked from bluebanboom/embpython.c
Example of embedding python in c.
#include <Python.h>
#include <stdio.h>
/*
* gcc embpython.c -I/usr/include/python2.7 -lpython
**/
void loadModule()
{
/* run objects with low-level calls */
char *arg1="sir", *arg2="robin", *cstr;
printf("Load Module err!\n");
@Coderx7
Coderx7 / test.c
Created April 20, 2020 07:48 — forked from nad2000/test.c
Basic examples to show how to embed and extend Python in C including: creation of module in C with functions handling and building Python objects; importing and calling python functions from C.
/* Example of embedding Python in another program */
// to compile run:
// gcc -o test $(python-config --cflags) test.c $(python-config --ldflags) && ./test
#include<stdio.h>
#include "Python.h"
void initxyzzy(void); /* Forward */
main(int argc, char **argv)
@Coderx7
Coderx7 / Install NVIDIA Driver and CUDA.md
Created April 11, 2018 19:56 — forked from zhanwenchen/Install NVIDIA Driver and CUDA.md
Install NVIDIA CUDA 8.0 on Ubuntu 16.04.3 LTS
@Coderx7
Coderx7 / Install NVIDIA Driver and CUDA.md
Created April 11, 2018 19:56 — forked from wangruohui/Install NVIDIA Driver and CUDA.md
Install NVIDIA Driver and CUDA on Ubuntu / CentOS / Fedora Linux OS
@Coderx7
Coderx7 / live_plot_notebook.py
Last active March 28, 2018 19:07 — forked from wassname/live_plot_notebook.py
Live plot using %matplotlib notebook in jupyter notebook
#برای نمایش بلادرنگ نمودار ترینینگ و تست ما
import numpy as np
from matplotlib import pyplot as plt
class LivePlotNotebook(object):
"""
Live plot using %matplotlib notebook in jupyter notebook
original url : https://gist.github.com/wassname/04e77eb821447705b399e8e7a6d082ce
"""
@Coderx7
Coderx7 / tsne visualization.py
Created March 28, 2018 04:17 — forked from dineshj1/tsne visualization
t-SNE visualization code
# Dinesh Jayaraman
# Based on code by
# Authors: Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Olivier Grisel <olivier.grisel@ensta.org>
# Mathieu Blondel <mathieu@mblondel.org>
# Gael Varoquaux
# License: BSD 3 clause (C) INRIA 2011
print(__doc__)
@Coderx7
Coderx7 / pycaffe training script.py
Last active March 28, 2018 04:15 — forked from dineshj1/pycaffe training script
Training on Pycaffe
import argparse
import time
start_time=time.time();
################## Argument Parsing #####################################
parser=argparse.ArgumentParser();
parser.add_argument('-s','--solver', default='', type=str); # if empty, solver is created, else read
parser.add_argument('-res', '--resume_from', default='', type=str); #if not empty, resumes training from given file
parser.add_argument('-ft', '--finetune_from', default='', type=str);