本文整理汇总了Python中NeuralNetwork.NeuralNetwork.addLayer方法的典型用法代码示例。如果您正苦于以下问题:Python NeuralNetwork.addLayer方法的具体用法?Python NeuralNetwork.addLayer怎么用?Python NeuralNetwork.addLayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NeuralNetwork.NeuralNetwork
的用法示例。
在下文中一共展示了NeuralNetwork.addLayer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createLocalizationNetwork
# 需要导入模块: from NeuralNetwork import NeuralNetwork [as 别名]
# 或者: from NeuralNetwork.NeuralNetwork import addLayer [as 别名]
def createLocalizationNetwork(self):
if self.localizationType == "Rotary":
return RotaryLayer()
if self.localizationType == "Scaled":
return ScaledLayer()
if self.localizationType == "ScaledUp":
return ScaledUpLayer()
if self.localizationType == "ScaledWithOffset":
return ScaledWithOffsetLayer()
if self.localizationType == "Unitary":
return UnitaryLayer()
if self.localizationType == "FullyConnected":
network = NeuralNetwork()
network.addLayer(FullyConnectedLayer(self.inputW * self.inputH * self.inputC, 32, 0, "ReLu"))
network.addLayer(FullyConnectedLayer(32, 3*4, 1, "ReLu"))
return network
if self.localizationType == "ConvLayer":
network = NeuralNetwork()
network.addLayer(ConvLayer((self.inputW, self.inputH, self.inputC), (3, 3, self.inputC, self.inputC), 0, "ReLu"))
network.addLayer(FullyConnectedLayer(self.inputW * self.inputH * self.inputC, 3*4, 1, "ReLu"))
return network
示例2: createFullyConnectedNetwork
# 需要导入模块: from NeuralNetwork import NeuralNetwork [as 别名]
# 或者: from NeuralNetwork.NeuralNetwork import addLayer [as 别名]
def createFullyConnectedNetwork(parameters):
logger.info ("Creating a fully connected network")
network = NeuralNetwork()
idx = 0
for inputSize, outputSize in parameters:
isLastLayer = (idx == (len(parameters) - 1))
if isLastLayer:
nonlinearity = "Null"
else:
nonlinearity = "ReLu"
network.addLayer(FullyConnectedLayer(inputSize, outputSize, idx, nonlinearity))
idx += 1
return network
示例3: createSpatialTransformerWithFullyConnectedNetwork
# 需要导入模块: from NeuralNetwork import NeuralNetwork [as 别名]
# 或者: from NeuralNetwork.NeuralNetwork import addLayer [as 别名]
def createSpatialTransformerWithFullyConnectedNetwork(parameters, isVerbose):
logger.info ("Creating a fully connected network with a spatial transformer input layer")
network = NeuralNetwork()
idx = 0
for inputSize, outputSize in parameters:
isLastLayer = (idx == (len(parameters) - 1))
if isLastLayer:
nonlinearity = "Null"
else:
nonlinearity = "ReLu"
if idx == 0:
network.addLayer(SpatialTransformerLayer(inputSize[0], inputSize[1], inputSize[2],
outputSize[0], outputSize[1], outputSize[2], "ConvLayer"))
else:
network.addLayer(FullyConnectedLayer(inputSize, outputSize, idx, nonlinearity))
idx += 1
return network