Skip to content

Instantly share code, notes, and snippets.

View kris-singh's full-sized avatar
:bowtie:

Kris Singh kris-singh

:bowtie:
View GitHub Profile
# Path of eigen checked out from devlopement branch
cmake_minimum_required(VERSION 3.4)
project(Test)
set(CMAKE_CXX_FLAGS "-std=c++11")
include_directories(/Users/kris/Desktop/kmean/eigen-git-mirror)
add_executable(main eigen_example.cpp)
#include <algorithm>
#include <cmath>
from joblib import Parallel, delayed
import Queue
import os
# Define number of GPUs available
N_GPU = 4
# Put indices in queue
q = Queue.Queue(maxsize=N_GPU)
for i in range(N_GPU):
#include <torch/torch.h>
#include <iostream>
#include <ATen/Parallel.h>
#include <ATen/Aten.h>
using namespace at;
// using namespace torch;
void submodular_select(Tensor candidate_points, Tensor features_done, Tensor features)
{
@kris-singh
kris-singh / backward_grad.py
Created January 30, 2019 09:35
CrudeImplementation.
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import datasets, transforms
def backward_hook_function(grad_out):
print(grad_out.shape)
print(grad_out.norm())
# print("grad_norm", grad_in.norm())
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#include "cpu/vision.h"
template <typename scalar_t>
at::Tensor soft_nms_cpu_kernel(const at::Tensor& dets,
at::Tensor& scores,
const float threshold) {
AT_ASSERTM(!dets.type().is_cuda(), "dets must be a CPU tensor");
AT_ASSERTM(!scores.type().is_cuda(), "scores must be a CPU tensor");
class SelectLoss:
"""
Selection based on Loss values of samples.
No need of rejection sampling.
"""
def __init__(self, X, Y, fwd_batch_size, batch_size, _, loss):
"""
:param loss: loss function
:param x_train: training dataN
class SelectLoss:
"""
Selection based on Loss values of samples.
No need of rejection sampling.
"""
def __init__(self, X, Y, fwd_batch_size, batch_size, _, loss):
"""
:param loss: loss function
:param x_train: training dataN
from __future__ import division
from __future__ import print_function
import numpy as np
import six
import argparse
import keras
import gzip
import tensorflow as tf
import pickle
import pandas as pd
#include <mlpack/core.hpp>
#include <mlpack/core/optimizers/rmsprop/rmsprop.hpp>
#include <mlpack/methods/ann/init_rules/gaussian_init.hpp>
#include <mlpack/methods/ann/rbm/spike_slab_rbm_policy.hpp>
#include <mlpack/methods/ann/rbm.hpp>
#include <mlpack/methods/ann/rbm/binary_rbm_policy.hpp>
#include <mlpack/methods/softmax_regression/softmax_regression.hpp>
#include <mlpack/core/optimizers/minibatch_sgd/minibatch_sgd.hpp>
#include <mlpack/core/optimizers/sgd/sgd.hpp>
@kris-singh
kris-singh / cifar.cpp
Last active August 29, 2017 12:34
Cifar
#include <mlpack/core.hpp>
#include <mlpack/core/optimizers/rmsprop/rmsprop.hpp>
#include <mlpack/methods/ann/init_rules/gaussian_init.hpp>
#include <mlpack/methods/ann/rbm/spike_slab_rbm_policy.hpp>
#include <mlpack/methods/ann/rbm.hpp>
#include <mlpack/methods/ann/rbm/binary_rbm_policy.hpp>
#include <mlpack/methods/softmax_regression/softmax_regression.hpp>
#include <mlpack/core/optimizers/minibatch_sgd/minibatch_sgd.hpp>
#include <mlpack/core/optimizers/sgd/sgd.hpp>