void InitFunc(StreamingContext sc) { switch (this) { case MaxPooling2D <float> maxPooling2DF: maxPooling2DF.SingleInputForward = x => MaxPooling2DF.SingleInputForward(x, maxPooling2DF.KernelWidth, maxPooling2DF.KernelHeight, maxPooling2DF.StrideX, maxPooling2DF.StrideY, maxPooling2DF.PadX, maxPooling2DF.PadY, maxPooling2DF.CoverAll, maxPooling2DF.OutputIndicesList, maxPooling2DF); maxPooling2DF.SingleOutputBackward = (y, x) => MaxPooling2DF.SingleOutputBackward(y, x, maxPooling2DF.OutputIndicesList); break; case MaxPooling2D <double> maxPooling2DD: maxPooling2DD.SingleInputForward = x => MaxPooling2DD.SingleInputForward(x, maxPooling2DD.KernelWidth, maxPooling2DD.KernelHeight, maxPooling2DD.StrideX, maxPooling2DD.StrideY, maxPooling2DD.PadX, maxPooling2DD.PadY, maxPooling2DD.CoverAll, maxPooling2DD.OutputIndicesList, maxPooling2DD); maxPooling2DD.SingleOutputBackward = (y, x) => MaxPooling2DD.SingleOutputBackward(y, x, maxPooling2DD.OutputIndicesList); break; } }
void InitFunc(StreamingContext sc) { if (IsParallel) { switch (this) { case MaxPooling2D <float> maxPooling2DF: maxPooling2DF.SingleInputForward = x => MaxPooling2DF.SingleInputForward(x, maxPooling2DF.KernelWidth, maxPooling2DF.KernelHeight, maxPooling2DF.StrideX, maxPooling2DF.StrideY, maxPooling2DF.PadX, maxPooling2DF.PadY, maxPooling2DF.CoverAll, maxPooling2DF.OutputIndicesList, CPU.MaxPooling2DF.GetForwardResult, maxPooling2DF.ForwardKernel, maxPooling2DF); break; case MaxPooling2D <double> maxPooling2DD: maxPooling2DD.SingleInputForward = x => MaxPooling2DD.SingleInputForward(x, maxPooling2DD.KernelWidth, maxPooling2DD.KernelHeight, maxPooling2DD.StrideX, maxPooling2DD.StrideY, maxPooling2DD.PadX, maxPooling2DD.PadY, maxPooling2DD.CoverAll, maxPooling2DD.OutputIndicesList, CPU.MaxPooling2DD.GetForwardResult, maxPooling2DD.ForwardKernel, maxPooling2DD); break; } } }