【发布时间】:2019-06-22 13:40:18
【问题描述】:
tensorflow2.0有类init和call的格式
例如
class MyModel(Model):
def __init__(self):
super(MyModel, self).__init__()
self.conv1 = Conv2D(32, 3, activation='relu')
self.flatten = Flatten()
self.d1 = Dense(128, activation='relu')
self.d2 = Dense(10, activation='softmax')
def call(self, x):
x = self.conv1(x)
x = self.flatten(x)
x = self.d1(x)
return self.d2(x)
model = MyModel()
我的问题是,如果我想改变
> def call(self, x):
> x = self.conv1(x)
> x = self.flatten(x)
> x = self.d1(x)
> return self.d2(x,activation='relu')
这会导致错误。
如果我想在某些过程中更改属性
我该怎么做?
【问题讨论】:
标签: keras tensorflow2.0