Skip to content

Instantly share code, notes, and snippets.

# pip3 install websocket-client
import websocket
from multiprocessing import Process, Value, Lock, Event
from datetime import datetime
import dateutil.parser
import json
from time import sleep
class SFDInfo():
def __init__(self):
import websocket
import json
from pprint import pprint
def on_message(ws, message):
message = json.loads(message)
pprint(message)
def on_error(ws, error):
print(error)
# 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)