class ModelObj: # 网络对象
    def __init__(self, ObjID, ObjType, ObjLable, ParaString, ObjX, ObjY):
        self.ObjID = ObjID  # 图元号
        self.ObjType = ObjType  # 图元类别
        self.ObjLable = ObjLable  # 对象标签
        self.ParaString = ParaString  # 参数字符串
        self.ObjX = ObjX  # 对象位置x坐标
        self.ObjY = ObjY  # 对象位置y坐标
class Conv_Class(ModelObj):  # 卷积对象
    def __init__(self, ObjID, ObjType, ObjLable, ParaString, ObjX, ObjY):
        super().__init__(ObjID, ObjType, ObjLable, ParaString, ObjX, ObjY)
        # self.ConvProc = self.conv_proc  # 基本操作函数--------------------------------------
        self.SetConvPara = self.setconv_para  # 参数设置函数
    def setconv_para(self):  # 定义设置卷积参数的函数SetConvPara()
        kernel_h = int(input("请输入卷积核的高度: "))  # 用户输入卷积核的高度 3
        kernel_w = int(input("请输入卷积核的宽度: "))  # 用户输入卷积核的宽度 3
        # 用户输入卷积核的值 
        kernel = [] 
        #           [[1.289202, -1.471377, -0.238452],
        #           [-0.562343, -0.019988, -0.441446],
        #           [1.627381, 1.390266, 0.812486]]
        print("请输入卷积核的值：")
        for i in range(kernel_h):
            row = [float(val) for val in input().split()]
            kernel.append(row)

        stride = int(input("请输入步长: "))  # 用户输入步长 1
        padding = int(input("请输入填充: "))  # 用户输入填充 0

        # 返回ConvPara参数，这里用一个字典来存储
        ConvPara = {"kernel": kernel, "kernel_h": kernel_h,
                    "kernel_w": kernel_w, "stride": stride,
                    "padding": padding}
        return ConvPara
if __name__ == '__main__':
    Conv = Conv_Class("Conv1", 2, "卷积1", [], 250, 330)
    ConvPara = Conv.SetConvPara()
