chundoong-lab-ta/APWS23/project/uNet.h

84 lines
2.9 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 + 64)
#define OFFSET8 (OFFSET7 + 128*64*3*3)
#define OFFSET9 (OFFSET8 + 128)
#define OFFSET10 (OFFSET9 + 128)
#define OFFSET11 (OFFSET10 + 128*128*3*3)
#define OFFSET12 (OFFSET11 + 128)
#define OFFSET13 (OFFSET12 + 128)
#define OFFSET14 (OFFSET13 + 256*128*3*3)
#define OFFSET15 (OFFSET14 + 256)
#define OFFSET16 (OFFSET15 + 256)
#define OFFSET17 (OFFSET16 + 256*256*3*3)
#define OFFSET18 (OFFSET17 + 256)
#define OFFSET19 (OFFSET18 + 256)
#define OFFSET20 (OFFSET19 + 512*512*3*3)
#define OFFSET21 (OFFSET20 + 512)
#define OFFSET22 (OFFSET21 + 512)
#define OFFSET23 (OFFSET22 + 1024*512*3*3)
#define OFFSET24 (OFFSET23 + 1024)
#define OFFSET25 (OFFSET24 + 1024)
#define OFFSET26 (OFFSET25 + 1024*1024*3*3)
#define OFFSET27 (OFFSET26 + 1024)
#define OFFSET28 (OFFSET27 + 1024)
#define OFFSET29 (OFFSET28 + 1024*512*2*2)
#define OFFSET30 (OFFSET29 + 512)
#define OFFSET31 (OFFSET30 + 512*1024*3*3)
#define OFFSET32 (OFFSET31 + 512)
#define OFFSET33 (OFFSET32 + 512)
#define OFFSET34 (OFFSET33 + 512*512*3*3)
#define OFFSET35 (OFFSET34 + 512)
#define OFFSET36 (OFFSET35 + 512)
#define OFFSET37 (OFFSET36 + 512)
#define OFFSET38 (OFFSET37 + 512*256*2*2)
#define OFFSET39 (OFFSET38 + 256)
#define OFFSET40 (OFFSET39 + 256*512*3*3)
#define OFFSET41 (OFFSET40 + 256)
#define OFFSET42 (OFFSET41 + 256)
#define OFFSET43 (OFFSET42 + 256*256*3*3)
#define OFFSET44 (OFFSET43 + 256)
#define OFFSET45 (OFFSET44 + 256)
#define OFFSET46 (OFFSET45 + 256*128*2*2)
#define OFFSET47 (OFFSET46 + 128)
#define OFFSET48 (OFFSET47 + 128*256*3*3)
#define OFFSET49 (OFFSET48 + 128)
#define OFFSET50 (OFFSET49 + 128)
#define OFFSET51 (OFFSET50 + 128*128*3*3)
#define OFFSET52 (OFFSET51 + 128)
#define OFFSET53 (OFFSET52 + 128)
#define OFFSET54 (OFFSET53 + 128*64*2*2)
#define OFFSET55 (OFFSET54 + 64)
#define OFFSET56 (OFFSET55 + 64*128*3*3)
#define OFFSET57 (OFFSET56 + 64)
#define OFFSET58 (OFFSET57 + 64)
#define OFFSET59 (OFFSET58 + 64*64*3*3)
#define OFFSET60 (OFFSET59 + 64)
#define OFFSET61 (OFFSET60 + 64)
#define OFFSET62 (OFFSET61 + 2*64*1*1)
#define OFFSET63 (OFFSET62 + 2)
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 *weight, Tensor *bias, Tensor *running_mean, Tensor *running_var, Tensor *output, const float eps);
void ConvTranspose2d(Tensor *input, Tensor *weight, Tensor *bias, Tensor *output, int stride, int pad);
void Softmax(Tensor *input, Tensor *output);
void styler_initialize(int, int, char*);
void styler(int, float*, char*);
void styler_finalize();