示例#1
0
文件: snTensor.cs 项目: ybhjx/skynet
        public Tensor(snLSize lsz)
        {
            lsz_ = lsz;

            int sz = (int)(lsz.w * lsz.h * lsz.ch * lsz.bsz * sizeof(float));

            if (sz > 0)
            {
                data_ = (float *)Marshal.AllocHGlobal(sz);
            }
        }
示例#2
0
文件: snTensor.cs 项目: ybhjx/skynet
        public Tensor(snLSize lsz, float *data)
        {
            lsz_ = lsz;

            UInt64 sz = lsz.w * lsz.h * lsz.ch * lsz.bsz * sizeof(float);

            if (sz > 0)
            {
                data_ = (float *)Marshal.AllocHGlobal((int)sz);
                MemCopy((IntPtr)data_, (IntPtr)data, sz);
            }
        }
示例#3
0
 static extern bool snSetWeightNode(void *net, IntPtr name, snLSize wsz, float *wData);
示例#4
0
 static extern bool snTraining(void *net, float lr, snLSize insz, float *iLayer,
                               snLSize osz, float *outData, float *targetData, float *outAccurate);
示例#5
0
 static extern bool snBackward(void *net, float lr, snLSize gsz, float *grad);
示例#6
0
 static extern bool snForward(void *net, bool isLern, snLSize isz, float *iLayer, snLSize osz, float *outData);
示例#7
0
        public Tensor(snLSize lsz = new snLSize(), float[] data = null){
        
            lsz_ = lsz;

            data_ = data;
        }