本文整理汇总了Python中keras.engine.training.Model.get_output_shape_for方法的典型用法代码示例。如果您正苦于以下问题:Python Model.get_output_shape_for方法的具体用法?Python Model.get_output_shape_for怎么用?Python Model.get_output_shape_for使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类keras.engine.training.Model
的用法示例。
在下文中一共展示了Model.get_output_shape_for方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_resnet
# 需要导入模块: from keras.engine.training import Model [as 别名]
# 或者: from keras.engine.training.Model import get_output_shape_for [as 别名]
def test_resnet():
n = 4
x = Input(shape=(1, 8, 8))
y = sequential([
conv2d_block(n),
resnet(n)
])(x)
model = Model(x, y)
assert model.get_output_shape_for((None, 1, 8, 8)) == (None, n, 8, 8)
示例2: test_conv2d_block
# 需要导入模块: from keras.engine.training import Model [as 别名]
# 或者: from keras.engine.training.Model import get_output_shape_for [as 别名]
def test_conv2d_block():
x = Input(shape=(1, 8, 8))
y = sequential(
conv2d_block(4)
)(x)
model = Model(x, y)
assert model.get_output_shape_for((None, 1, 8, 8)) == (None, 4, 8, 8)
x = Input(shape=(1, 8, 8))
y = sequential(
conv2d_block(4, pooling='avg')
)(x)
model = Model(x, y)
assert model.get_output_shape_for((None, 1, 8, 8)) == (None, 4, 4, 4)
x = Input(shape=(1, 8, 8))
y = sequential(
conv2d_block(4, up=True)
)(x)
model = Model(x, y)
assert model.get_output_shape_for((None, 1, 8, 8)) == (None, 4, 16, 16)