分享

python语言学习:python语言学习中的定义类、定义函数、封装api等详细攻略

 处女座的程序猿 2021-09-28

python语言学习:python语言学习中的定义类、定义函数、封装api等详细攻略


python语言学习中的定义类

1、定义类的结构形式

class LSTMRNN(object):
    # __init__()方法: 用来传入各种参数
    def __init__(self, n_steps, input_size, output_size, cell_size, batch_size):
        '''
        :param n_steps: 每批数据总包含多少时间刻度,详看博客,LSTM每一个batchz内,需要3步

        '''
        self.n_steps = n_steps          
        self.input_size = input_size
        self.output_size = output_size
        self.cell_size = cell_size
        self.batch_size = batch_size

    #add_input_layer()方法:用来增加一个输入层
    def add_input_layer(self,):
        pass

python语言学习中的定义函数

1、pass   #放在函数内,执行空语句

 

python语言学习中封装api

    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多