#author("2019-12-03T17:40:59+09:00","default:Authors","Authors")
#author("2019-12-27T10:24:07+09:00","default:Authors","Authors")
* 書式保持メモ [#sda4f9c8]

*** https://qiita.com/okoppe8/items/b56499fc04e6c2193b9d [#z200e3e6]

 LOGGING = {
     'version': 1,
     'disable_existing_loggers': False,
     'formatters': {
         'production': {
             'format': '%(asctime)s [%(levelname)s] %(process)d %(thread)d '
                       '%(pathname)s:%(lineno)d %(message)s'
         },
     },
     'handlers': {
         'file': {
             'class': 'logging.handlers.TimedRotatingFileHandler',
             'filename': '/var/log/django/django.log',
             'formatter': 'production',
 #            'level': 'INFO',
             'when': 'D',
             'interval': 1,
             'backupCount': 14,
         },
     },
     'loggers': {
         '': {
             'handlers': ['file'],
 #            'level': 'INFO',
             'propagate': False,
         },
         'django': {
             'handlers': ['file'],
 #            'level': 'INFO',
             'propagate': False,
         },
     },

 import sys
 import os
 import glob
 import random
 import shutil
 import errno
 
 args = sys.argv
 
 try:
     os.makedirs( "./test" )
     os.makedirs( "./train" )
     os.makedirs( "./valid" )
 except OSError as e:
     if e.errno != errno.EEXIST:
         raise e
 
 fileList = glob.glob( "./*.mid*" )
 
 #print( "hello" )
 #print( args[1] )
 for file in fileList:
     randNum = random.randint(0,11)
     if 0 == randNum:
         shutil.copy( file, "./test" )
     elif 1 == randNum:
         shutil.copy( file, "./valid" )
     else:
         shutil.copy( file, "./train" )
 
 sys.exit()

 #include <stdio.h>
 #include <time.h>
 #include <stdlib.h>
 
 int main( void )
 {
     int rtnCod = 0;
     char strArr[10][9] = { "", };
     int intArr[10] = { 0, };
     int cnt = 0;
     int num = 0;
 
     srand( (unsigned int)time( NULL ) );
 
     for( cnt = 0; 10 > cnt; cnt++ )
     {
         intArr[cnt] = rand();
         printf( "%x\r\n", intArr[cnt] );
         snprintf( strArr[cnt], 9, "%x", intArr[cnt] );
         printf( "%s\r\n", strArr[cnt] );
         num = strtol( strArr[cnt], NULL, 16 );
         printf( "%x\r\n", num );
     }
     return( rtnCod );
 }

 #include <stdio.h>    
 #include <sys/stat.h>    
 //#include <time.h>    
 #include <stdlib.h>    
     
 int main( void )    
 {    
     int rtnCod = 0;    
     int cnt = 0;    
     int num = 0;    
     int bBuf = 0;    
     int eBuf = 0;    
     int fSize = 0;    
     FILE* INFO = NULL;    
     struct stat st;                             /* for stat()                             */    
     char *inBuf;                                /* メモリ作業領域                         */    
     char fileName[8] = "./a.gem";    
     char word[9] = "";    
         
     stat( fileName, &st );    
     fSize = st.st_size;    
     inBuf = (char*)malloc( fSize );    
     INFO = fopen( fileName, "r");    
     fread( inBuf, sizeof(char), fSize, INFO );    
     fclose( INFO );    
     
 //    printf( "%s\n--end--\n", inBuf );    
     
     for( cnt = 0; fSize > cnt; cnt++ )    
     {    
         if( ' ' == inBuf[cnt] )    
         {    
             eBuf = cnt + 1;    
             snprintf( word, eBuf - bBuf, "%s", &(inBuf[bBuf]) );    
             bBuf = cnt + 1;    
             num = strtol( word, NULL, 16 );    
             printf( "%x\n", num );    
         }    
     }    
     
     free( inBuf );    
     return( rtnCod );    
 }

 int delta = START_CUE_POS;
 int dOffset = setX(GRID_H * INTERVAL);
 int note = ZERO;
 int len = ZERO;
 int left = ZERO;
 int right = ZERO;
 
 for( 時点数 )
 {
     barData取得
     for( 各パート: cnt_beg, cnt_end )
     {
         note = getNoteM( barData, cnt_beg );
         if( ONあり )
         {
             if( ZERO != offRsv[cnt_beg] )
             {
                 left = getX(offRsv[cnt_beg]);    
                 len = delta - left;    
                 if( tgt == cnt_beg )
                 {
                     len += dOffset;
                 }
                 offRsv[cnt_beg] += setL(len);
                 vc_funcs_barList[cnt_beg].insert( offRsv[cnt_beg] );
                 vc_funcs_barList[ALL_PART].insert( offRsv[cnt_beg] );
                 offRsv[cnt_beg] = ZERO;
             }
             
             if( noteが範囲内 )
             {
                 offRsv[cnt_beg] = setX(delta) + key2Y((u1)(note)) + setK(cnt_beg);
                 if( tgtPart )
                 {
                     offRsv[cnt_beg] += dOffset;
                 }
             }
         }
         else
         {
             if( (ZERO == note) && (ZERO != offRsv[cnt_beg]) )
             {
                 left = getX(offRsv[cnt_beg]);    
                 len = delta - left;    
                 if( tgt == cnt_beg )
                 {
                     len += dOffset;
                 }
                 offRsv[cnt_beg] += setL(len);
                 vc_funcs_barList[cnt_beg].insert( offRsv[cnt_beg] );
                 vc_funcs_barList[ALL_PART].insert( offRsv[cnt_beg] );
                 offRsv[cnt_beg] = ZERO;
             }
         }
     }
 
     delta += GRID_H;
 }

 //int delta = START_CUE_POS;
 //int dOffset = setX(GRID_H * INTERVAL);
 //int note = ZERO;
 //int len = ZERO;
 int left = ZERO;
 //int right = ZERO;
 int ePos = ZERO;
 int cPos = START_CUE_POS;
 int offset = INTERVAL * GRID_H;
 
 ePos = 最終位置
 
 for( ; ePos > cPos; cPos += GRID_H )
 {
     for( 各パート: cnt_beg, cnt_end )
     {
         sPos = cPos;
         if( tgt == cnt_beg )
         {
             sPos += offset;
         }
 
         lower = lower_bound(sPos);
         if( end == lower )
         {
             continue;
         }
 
         note = getNote( *lower );
         left = getX( *lower );
         right = left + getL( *lower );
         if( sPos == left )
         {
             ON予約
         }
         else( lとrの間 )
         {
             N予約
         }

 import torch                                                    # for pytorch                                      #
 from torch.autograd import Variable                             # for Variable                                     #
 
 X = torch.randn( 4, 4, 4 )
 prevX = Variable(X[-1:, :, :].data, requires_grad=False)
 #print(X)
 #print("="*80)
 #print(prevX)
 #prevX = None
 
 X = torch.randn( 4, 4, 4 )
 Xm1 = []
 
 #print( Xm1 )
 
 Xm1.append(prevX if prevX is not None else X[:1, :, :] * 0)
 
 if prevX is not None:
 #    Xm2 = prevX
     Xm2 = torch.cat((prevX, X[:-1, :, :]), 0)
 else:
 #    Xm2 = torch.tensor(X[:1, :, :] * 0)
     Xm2 = torch.cat((X[:1, :, :] * 0, X[:-1, :, :]), 0)
 
 #print( Xm1 )
 #print( Xm2 )
 
 if len(X) > 1:
     Xm1.append(X[:-1, :, :])
 #    Xm2 = torch.cat((Xm2,X[:-1, :, :]))
 
 #print( Xm1 )
 
 Xm1 = torch.cat(Xm1, 0)
 
 #print( Xm1 )
 #print( Xm2 )
 
 source = torch.cat([X, Xm1], 2)
 source2 = torch.cat((X, Xm2), dim=2)
 
 #print( source )
 #print("="*80)
 #print( source2 )
 
 #l = [X, Xm1]
 #t = (X, Xm1)
 #print(l)
 #print(t)
 #print(type(l))
 #print(type(t))

 ■頻度ログ残し
  生成したらID払出し(元種別番号+種別番号+セット番号+Index)
  フラグとともに保持しておき
  対位系のときにIDも送信
  IDをログに残す
 
 
 ■中断再開とColab連続稼働
  https://qiita.com/iZuno-K/items/453cbc023a477359f272
 
 
 ■数を絞って実現性証明
  HHC
 
 ■手動でFP16
  https://qiita.com/arutema47/items/d9e097f00b0b4934d07a
 
 	01G	g1→gs1	11G	21G	31G	0DG	1DG	2DG	3DG	4DG	D1G	D2G	D3G	D4G
 learn	sc1		sc2	sc3	sc4	scd	t1d	t2d	t3d	t4d	t1d	t2d	t3d	t4d
 input	random	g1	gs1_8	gs2_s	gs3_s	random	time1	time2	time3	time4	dr	dr	dr	dr
 output1	g1	gs1	gs2	gs3	gs4	dr	dr	dr	dr	dr	time1	time2	time3	time4
 output2														
 source1														
 source2														
 動作	自動	自動	自動	自動	自動	自動	手動	手動	手動	手動	手動	手動	手動	手動
 切分け	1g	-	2g	3g	4g	dg								
 		s + 8bit	s + 8bit*2	s + 8bit*3	s + 8bit*4

https://colab.research.google.com/drive/19icmsmrvXL3Ozv4UylAKgiHS5Lm89NVi#scrollTo=6V9nyBt2N1QI

 #!/bin/bash
 
 lNum=0
 cNum=0
 strBuf=`cat $1`
 
 while read line
 do
   lNum=$(expr $lNum + 1)
   CS=`echo $line | sed -e 's@[^ ]@@g'`
   cNum=${#CS}
   echo $lNum : $cNum
 done << END
 cat $strBuf
 END
 
 echo $lNum

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS