Skip to content

Instantly share code, notes, and snippets.

# pip3 install tornado pubnub python-dateutil
# python3 -u sfd.py | tee sfd.log
from multiprocessing import Process, Value, Lock, Event
from datetime import datetime
import dateutil.parser
from pubnub.callbacks import SubscribeCallback
from pubnub.enums import PNStatusCategory
from pubnub.pnconfiguration import PNConfiguration
from pubnub.pubnub_tornado import PubNubTornado
from pubnub.pnconfiguration import PNReconnectionPolicy
/*
* L4D2特殊感染者BOTのプレイスタイルをカスタマイズする実験的なプラグイン
*
* 出現する特殊感染者BOTの2/3のだけ改変します
*
* キー入力をシミュレートすることでBOTを操作するため
* システムはデフォルトのまま!!
*
* addons/sourcemod/scripting
* において
require 'nn'
local N = 1000
local FEAT = 64
local S = 2
function nn.SpatialConvolution:reset()
self.weight:uniform(0, 1)
self.bias:zero()
end
require 'cutorch'
require 'cunn'
require 'cudnn'
require 'sys'
-- WINOGRAD benchmark
-- required: cuDNN v5, cudnn.torch R5 branch
function create_model(ch)
local model = nn.Sequential()
require 'cutorch'
require 'cunn'
require 'cudnn'
require 'sys'
-- WINOGRAD benchmark
-- required: cuDNN v5, cudnn.torch R5 branch
function create_model(ch) -- simple 3x3 conv model
local model = nn.Sequential()
// __attribute__((aligned(16))) float input[n], weight[n];
float dot_sse(float *input, float *weight, int n)
{
__attribute__((aligned(16))) float mm[4] = {0};
__m128 x, u;
int pk_lp = (n & 0xfffffffc);
int i;
float sum = 0;
u = _mm_setzero_ps();
for (i = 0; i < pk_lp; i += 4) {
name: "srcnn"
layer {
name: "input"
type: "Input"
top: "input"
input_param { shape: { dim: 1 dim: 3 dim: 32 dim: 32 } }
}
layer {
name: "conv1_layer"
type: "Convolution"
require 'nn'
torch.setdefaulttensortype("torch.FloatTensor")
upconv = nn.SpatialFullConvolution(1, 1, 2, 2, 2, 2, 0, 0)
input = torch.Tensor({{1, 10},{100, 1000}}):reshape(1, 1, 2, 2) -- (batch_size, input_dim, height, width)
weight = torch.Tensor({{1, 2}, {3, 4}}) -- 1x1x2x2 filter
bias = torch.Tensor({0.5})
upconv.weight:copy(weight)
upconv.bias:copy(bias)
import numpy as np
import scipy as sp
import xgboost as xgb
from hyperopt import hp, fmin, tpe
from sklearn import datasets
from sklearn import cross_validation
from sklearn.metrics import confusion_matrix
np.random.seed(71)
iris = datasets.load_iris()
This file has been truncated, but you can view the full file.