小编Sen*_*t07的帖子

从python中的子类调用父类构造函数

所以,如果我有一个班级:

 class Person(object):
'''A class with several methods that revolve around a person's Name and Age.'''

    def __init__(self, name = 'Jane Doe', year = 2012):
        '''The default constructor for the Person class.'''
        self.n = name
        self.y = year
Run Code Online (Sandbox Code Playgroud)

然后这个子类:

 class Instructor(Person):
'''A subclass of the Person class, overloads the constructor with a new parameter.'''
     def __init__(self, name, year, degree):
         Person.__init__(self, name, year)
Run Code Online (Sandbox Code Playgroud)

我有点迷失了如何让子类调用并使用父类构造函数,name并在子类中year添加新参数degree.

python inheritance

44
推荐指数
1
解决办法
5万
查看次数

如何在张量流中恢复部分图?

我想只恢复张量流中计算图的一部分。我的架构包含两个网络。第一个网络的输出是第二个网络的输入。第一个网络是预先训练的,我想从检查点恢复。我也不想更新第一个网络的参数。我可以遵循一个例子来实现这一目标吗?

谢谢

python machine-learning deep-learning tensorflow

4
推荐指数
1
解决办法
1825
查看次数