122 lines
4.6 KiB
C
122 lines
4.6 KiB
C
#pragma once
|
|
|
|
#include "tensor.h"
|
|
|
|
// Model parameters
|
|
#define PARAMETER_FILE_SIZE 45663232
|
|
#define NUM_IMAGES 256
|
|
|
|
#define OFFSET0 0
|
|
#define OFFSET1 (OFFSET0 + 64*3*3*3)
|
|
#define OFFSET2 (OFFSET1 + 64)
|
|
#define OFFSET3 (OFFSET2 + 64)
|
|
#define OFFSET4 (OFFSET3 + 64*64*3*3)
|
|
#define OFFSET5 (OFFSET4 + 64)
|
|
#define OFFSET6 (OFFSET5 + 64)
|
|
#define OFFSET7 (OFFSET6 + 128*64*3*3)
|
|
#define OFFSET8 (OFFSET7 + 128)
|
|
#define OFFSET9 (OFFSET8 + 128)
|
|
#define OFFSET10 (OFFSET9 + 128*128*3*3)
|
|
#define OFFSET11 (OFFSET10 + 128)
|
|
#define OFFSET12 (OFFSET11 + 128)
|
|
#define OFFSET13 (OFFSET12 + 256*128*3*3)
|
|
#define OFFSET14 (OFFSET13 + 256)
|
|
#define OFFSET15 (OFFSET14 + 256)
|
|
#define OFFSET16 (OFFSET15 + 256*256*3*3)
|
|
#define OFFSET17 (OFFSET16 + 256)
|
|
#define OFFSET18 (OFFSET17 + 256)
|
|
#define OFFSET19 (OFFSET18 + 512*256*3*3)
|
|
#define OFFSET20 (OFFSET19 + 512)
|
|
#define OFFSET21 (OFFSET20 + 512)
|
|
#define OFFSET22 (OFFSET21 + 512*512*3*3)
|
|
#define OFFSET23 (OFFSET22 + 512)
|
|
#define OFFSET24 (OFFSET23 + 512)
|
|
#define OFFSET25 (OFFSET24 + 1024*512*3*3)
|
|
#define OFFSET26 (OFFSET25 + 1024)
|
|
#define OFFSET27 (OFFSET26 + 1024)
|
|
#define OFFSET28 (OFFSET27 + 1024*1024*3*3)
|
|
#define OFFSET29 (OFFSET28 + 1024)
|
|
#define OFFSET30 (OFFSET29 + 1024)
|
|
#define OFFSET31 (OFFSET30 + 1024*512*2*2)
|
|
#define OFFSET32 (OFFSET31 + 512)
|
|
#define OFFSET33 (OFFSET32 + 512*1024*3*3)
|
|
#define OFFSET34 (OFFSET33 + 512)
|
|
#define OFFSET35 (OFFSET34 + 512)
|
|
#define OFFSET36 (OFFSET35 + 512*512*3*3)
|
|
#define OFFSET37 (OFFSET36 + 512)
|
|
#define OFFSET38 (OFFSET37 + 512)
|
|
#define OFFSET39 (OFFSET38 + 512*256*2*2)
|
|
#define OFFSET40 (OFFSET39 + 256)
|
|
#define OFFSET41 (OFFSET40 + 256*512*3*3)
|
|
#define OFFSET42 (OFFSET41 + 256)
|
|
#define OFFSET43 (OFFSET42 + 256)
|
|
#define OFFSET44 (OFFSET43 + 256*256*3*3)
|
|
#define OFFSET45 (OFFSET44 + 256)
|
|
#define OFFSET46 (OFFSET45 + 256)
|
|
#define OFFSET47 (OFFSET46 + 256*128*2*2)
|
|
#define OFFSET48 (OFFSET47 + 128)
|
|
#define OFFSET49 (OFFSET48 + 128*256*3*3)
|
|
#define OFFSET50 (OFFSET49 + 128)
|
|
#define OFFSET51 (OFFSET50 + 128)
|
|
#define OFFSET52 (OFFSET51 + 128*128*3*3)
|
|
#define OFFSET53 (OFFSET52 + 128)
|
|
#define OFFSET54 (OFFSET53 + 128)
|
|
#define OFFSET55 (OFFSET54 + 128*64*2*2)
|
|
#define OFFSET56 (OFFSET55 + 64)
|
|
#define OFFSET57 (OFFSET56 + 64*128*3*3)
|
|
#define OFFSET58 (OFFSET57 + 64)
|
|
#define OFFSET59 (OFFSET58 + 64)
|
|
#define OFFSET60 (OFFSET59 + 64*64*3*3)
|
|
#define OFFSET61 (OFFSET60 + 64)
|
|
#define OFFSET62 (OFFSET61 + 64)
|
|
#define OFFSET63 (OFFSET62 + 2*64*1*1)
|
|
#define OFFSET64 (OFFSET63 + 2)
|
|
#define OFFSET65 (OFFSET64 + 64)
|
|
#define OFFSET66 (OFFSET65 + 64)
|
|
#define OFFSET67 (OFFSET66 + 64)
|
|
#define OFFSET68 (OFFSET67 + 64)
|
|
#define OFFSET69 (OFFSET68 + 128)
|
|
#define OFFSET70 (OFFSET69 + 128)
|
|
#define OFFSET71 (OFFSET70 + 128)
|
|
#define OFFSET72 (OFFSET71 + 128)
|
|
#define OFFSET73 (OFFSET72 + 256)
|
|
#define OFFSET74 (OFFSET73 + 256)
|
|
#define OFFSET75 (OFFSET74 + 256)
|
|
#define OFFSET76 (OFFSET75 + 256)
|
|
#define OFFSET77 (OFFSET76 + 512)
|
|
#define OFFSET78 (OFFSET77 + 512)
|
|
#define OFFSET79 (OFFSET78 + 512)
|
|
#define OFFSET80 (OFFSET79 + 512)
|
|
#define OFFSET81 (OFFSET80 + 1024)
|
|
#define OFFSET82 (OFFSET81 + 1024)
|
|
#define OFFSET83 (OFFSET82 + 1024)
|
|
#define OFFSET84 (OFFSET83 + 1024)
|
|
#define OFFSET85 (OFFSET84 + 512)
|
|
#define OFFSET86 (OFFSET85 + 512)
|
|
#define OFFSET87 (OFFSET86 + 512)
|
|
#define OFFSET88 (OFFSET87 + 512)
|
|
#define OFFSET89 (OFFSET88 + 256)
|
|
#define OFFSET90 (OFFSET89 + 256)
|
|
#define OFFSET91 (OFFSET90 + 256)
|
|
#define OFFSET92 (OFFSET91 + 256)
|
|
#define OFFSET93 (OFFSET92 + 128)
|
|
#define OFFSET94 (OFFSET93 + 128)
|
|
#define OFFSET95 (OFFSET94 + 128)
|
|
#define OFFSET96 (OFFSET95 + 128)
|
|
#define OFFSET97 (OFFSET96 + 64)
|
|
#define OFFSET98 (OFFSET97 + 64)
|
|
#define OFFSET99 (OFFSET98 + 64)
|
|
#define OFFSET100 (OFFSET99 + 64)
|
|
|
|
|
|
void Conv2d(Tensor *input, Tensor *weight, Tensor *bias, Tensor *output, int stride, int pad, int dilation, bool has_bias);
|
|
void ReLU(Tensor *inout);
|
|
void BatchNorm2d(Tensor *input, Tensor *gamma, Tensor *beta, Tensor *running_mean, Tensor *running_var, Tensor *output, const float eps, const float momentum);
|
|
void ConvTranspose2d(Tensor *input, Tensor *weight, Tensor *bias, Tensor *output, int stride, int pad);
|
|
float max4(float, float, float, float);
|
|
void MaxPool2d(Tensor *input, Tensor *output);
|
|
void Concat(Tensor *input1, Tensor *input2, Tensor *output);
|
|
void uNet_initialize(int, int, char*);
|
|
void uNet(Tensor*, Tensor*);
|
|
void uNet_finalize();
|