Skip to content

Instantly share code, notes, and snippets.

View yanring's full-sized avatar

Zijie Yan yanring

View GitHub Profile
@yanring
yanring / DropBlock2D.py
Created November 27, 2020 06:41
DropBlock2D
import time
import torch
from torch import nn
from torch.nn import Conv2d, Module, Linear, BatchNorm2d, ReLU
import torch.nn.functional as F
from torch.nn.modules.utils import _pair
from torch.autograd import Function
class DropBlock2D(nn.Module):
r"""Randomly zeroes 2D spatial blocks of the input tensor.
# for manjaro 需要手动切换内核
sudo pacman -S openssh nfs-utils
sudo systemctl enable sshd
sudo systemctl start sshd
# for ubuntu
sudo apt-get install --reinstall linux-headers-$(uname -r) linux-headers-generic build-essential dkms
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int n,res=9999999;
double max_d=0;
double d[52];
int p[52];
void dfs(int index, double sum_d, int sum_gold){
if(sum_d>=max_d){
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
// input
int n,w,tmp,res=0,flag;
#include <iostream>
#include <string>
using namespace std;
int daxie[26],xiaoxie[26];
string str;
void scan(string str){
int len = str.size();
for(char c : str){
if(c <= 'Z' and c>='A'){
daxie[c-'A']++;
begintime='2014-01-01';
endtime='2017-01-01';
total_value = 1000000;
name=['YNBY','GLDQ','WLY','SQJT','WHHX','GTDL','ZSYH','ZGPA','GTJA','DEEJ']';
YNBY=w.wsd('000538.SZ','LOW,OPEN,CLOSE,HIGH',begintime,endtime); %调入云南白药股票四数据
GLDQ=w.wsd('000651.SZ','LOW,OPEN,CLOSE,HIGH',begintime,endtime); %调入格力电器数据
num=size(YNBY,1); %得到总历史数据个数
data =[];%所有股票的数据
a=[0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1]; %总仓位配比,为云南白药30%,格力电器30%,现金40%
p=[1,1,1]; %三者初始成本价格均为1,即云南白药单位一份1,格力电器单位一份1,现金单位一份为1