在tf.slim中,我想创建一堆带有丢失的完全连接的层。
来自文档的示例:
slim.stack(x, slim.fully_connected, [32, 64, 128], scope='fc')
,我想补充一下。
是否可以使用slim.stack或者我是否必须回到冗长的方法?
(pseudo-code) for every layer:
slim.dropout(slim.fully_connected(...)
答案 0 :(得分:2)
只需查看代码:https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/layers/python/layers/layers.py#L1976。您需要具有以下签名的本地函数:
outputs = layer(outputs, *layer_args, **kwargs)
答案 1 :(得分:1)
基于@guinny的评论,我可以创建一个本地函数:
<table class="table table-striped table-hover">
<tbody>
<tr class="titleRow">
<td colspan="100%">J11 - Project List, Equipment List, Drawing and Spec Registers, Hold Log - Multidiscipline</td>
</tr>
<tr class="colNames">
<th class="r_id
" id="r_id" hidden="true">
r_id
</th>
<th class="WBS
" id="WBS">
WBS
</th>
<th class="ActivityCode
" id="Activity Code">
Activity Code
</th>
<th class="PTTDescription
" id="PTT Description">
PTT Description
</th>
<th class="OriginalBudget
" id="Original Budget">
Original Budget
</th>
<th class="PCN
" id="PCN">
PCN
</th>
<th class="ControlBudget
" id="Control Budget">
Control Budget
</th>
<th class="Design
chgWidth" id="Design">
Design
<input value="1303" type="">
</th>
<th class="DisciplineCheck
chgWidth" id="Discipline Check">
Discipline Check
<input value="1304" type="">
</th>
<th class="ClientReview
chgWidth" id="Client Review">
Client Review
<input value="1305" type="">
</th>
<th class="Issue
chgWidth" id="Issue">
Issue
<input value="1306" type="">
</th>
</tr>
<tr>
<td colspan="6"></td>
<td class="percent">65.00<i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">15.00<i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">15.00<i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">5.00<i class="fa fa-percent" aria-hidden="true"></i>
</td>
</tr>
</tbody>
<tbody>
<tr>
<td class="Cell+-1" hidden="true">672168</td>
<td class="Cell+0">02-Project Controls - -</td>
<td class="Cell+1">J11</td>
<td class="Cell+2">desc1</td>
<td class="Cell+3">23</td>
<td class="Cell+4">0</td>
<td class="Cell+5">23</td>
<td class="percent">
<input id="Cell+6" class="input-sm-np pClass" value="21.00" min="0" max="100" style="background-color: rgb(255, 235, 156);" type="number"><i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">
<input id="Cell+7" class="input-sm-np pClass" value="46.00" min="0" max="100" style="background-color: rgb(255, 235, 156);" type="number"><i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">
<input id="Cell+8" class="input-sm-np pClass" value="29.00" min="0" max="100" style="background-color: rgb(255, 235, 156);" type="number"><i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">
<input id="Cell+9" class="input-sm-np pClass" value="2.00" min="0" max="100" style="background-color: rgb(255, 235, 156);" type="number"><i class="fa fa-percent" aria-hidden="true"></i>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<table class="table table-striped table-hover">
<tbody>
<tr class="titleRow">
<td colspan="100%">J29 - Narrative Design Multidiscipline</td>
</tr>
<tr class="colNames">
<th class="r_id
" id="r_id" hidden="true">
r_id
</th>
<th class="WBS
" id="WBS">
WBS
</th>
<th class="ActivityCode
" id="Activity Code">
Activity Code
</th>
<th class="PTTDescription
" id="PTT Description">
PTT Description
</th>
<th class="OriginalBudget
" id="Original Budget">
Original Budget
</th>
<th class="PCN
" id="PCN">
PCN
</th>
<th class="ControlBudget
" id="Control Budget">
Control Budget
</th>
<th class="Design
chgWidth" id="Design">
Design
<input value="1346" type="">
</th>
<th class="DisciplineCheck
chgWidth" id="Discipline Check">
Discipline Check
<input value="1347" type="">
</th>
<th class="IDC
chgWidth" id="IDC">
IDC
<input value="1348" type="">
</th>
<th class="ClientReview
chgWidth" id="Client Review">
Client Review
<input value="1349" type="">
</th>
<th class="Issue
chgWidth" id="Issue">
Issue
<input value="1350" type="">
</th>
</tr>
<tr>
<td colspan="6"></td>
<td class="percent">60.00<i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">10.00<i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">10.00<i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">15.00<i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">5.00<i class="fa fa-percent" aria-hidden="true"></i>
</td>
</tr>
</tbody>
<tbody>
<tr>
<td class="Cell+-1" hidden="true">672169</td>
<td class="Cell+0">03-System Staging - -</td>
<td class="Cell+1">J29</td>
<td class="Cell+2">desc2</td>
<td class="Cell+3">12</td>
<td class="Cell+4">0</td>
<td class="Cell+5">12</td>
<td class="percent">
<input id="Cell+6" class="input-sm-np pClass" value="10.00" min="0" max="100" style="background-color: rgb(255, 235, 156);" type="number"><i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">
<input id="Cell+7" class="input-sm-np pClass" value="20.00" min="0" max="100" style="background-color: rgb(255, 235, 156);" type="number"><i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">
<input id="Cell+8" class="input-sm-np pClass" value="30.00" min="0" max="100" style="background-color: rgb(255, 235, 156);" type="number"><i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">
<input id="Cell+9" class="input-sm-np pClass" value="20.00" min="0" max="100" style="background-color: rgb(255, 235, 156);" type="number"><i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">
<input id="Cell+10" class="input-sm-np pClass" value="20.00" min="0" max="100" style="background-color: rgb(255, 235, 156);" type="number"><i class="fa fa-percent" aria-hidden="true"></i>
</td>
</tr>
</tbody>
</table>
<div>
<input class="stepidhere" type="text" />
</div>
</div>
<div>
<table class="table table-striped table-hover">
<tbody>
<tr class="titleRow">
<td colspan="100%">J22 - SOW/Construction Bid Pkg Assembly - Const Bid Package assembly and Scope write-up - SDC</td>
</tr>
<tr class="colNames">
<th class="r_id
" id="r_id" hidden="true">
r_id
</th>
<th class="WBS
" id="WBS">
WBS
</th>
<th class="ActivityCode
" id="Activity Code">
Activity Code
</th>
<th class="PTTDescription
" id="PTT Description">
PTT Description
</th>
<th class="OriginalBudget
" id="Original Budget">
Original Budget
</th>
<th class="PCN
" id="PCN">
PCN
</th>
<th class="ControlBudget
" id="Control Budget">
Control Budget
</th>
<th class="DevelopPkg
chgWidth" id="Develop Pkg">
Develop Pkg
<input value="1337" type="">
</th>
<th class="DisciplineCheck
chgWidth" id="Discipline Check">
Discipline Check
<input value="1338" type="">
</th>
<th class="ClientReview
chgWidth" id="Client Review">
Client Review
<input value="1339" type="">
</th>
<th class="Issue
chgWidth" id="Issue">
Issue
<input value="1340" type="">
</th>
<th class="BidTime
chgWidth" id="Bid Time">
Bid Time
<input value="1341" type="">
</th>
<th class="BidEvaluation
chgWidth" id="Bid Evaluation">
Bid Evaluation
<input value="1342" type="">
</th>
<th class="Award
chgWidth" id="Award">
Award
<input value="1343" type="">
</th>
</tr>
<tr>
<td colspan="6"></td>
<td class="percent">60.00<i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">15.00<i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">10.00<i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">5.00<i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">0.00<i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">10.00<i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">0.00<i class="fa fa-percent" aria-hidden="true"></i>
</td>
</tr>
</tbody>
<tbody>
<tr>
<td class="Cell+-1" hidden="true">672170</td>
<td class="Cell+0">03-System Staging - -</td>
<td class="Cell+1">J22</td>
<td class="Cell+2">werwererwerwewerwerweerwerere</td>
<td class="Cell+3">6</td>
<td class="Cell+4">0</td>
<td class="Cell+5">6</td>
<td class="percent">
<input id="Cell+6" class="input-sm-np pClass" value="10.00" min="0" max="100" style="background-color: rgb(255, 235, 156);" type="number"><i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">
<input id="Cell+7" class="input-sm-np pClass" value="10.00" min="0" max="100" style="background-color: rgb(255, 235, 156);" type="number"><i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">
<input id="Cell+8" class="input-sm-np pClass" value="10.00" min="0" max="100" style="background-color: rgb(255, 235, 156);" type="number"><i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">
<input id="Cell+9" class="input-sm-np pClass" value="20.00" min="0" max="100" style="background-color: rgb(255, 235, 156);" type="number"><i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">
<input id="Cell+10" class="input-sm-np pClass" value="30.00" min="0" max="100" style="background-color: rgb(255, 235, 156);" type="number"><i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">
<input id="Cell+11" class="input-sm-np pClass" value="10.00" min="0" max="100" style="background-color: rgb(255, 235, 156);" type="number"><i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">
<input id="Cell+12" class="input-sm-np pClass" value="10.00" min="0" max="100" style="background-color: rgb(255, 235, 156);" type="number"><i class="fa fa-percent" aria-hidden="true"></i>
</td>
</tr>
<tr>
<td class="Cell+-1" hidden="true">672171</td>
<td class="Cell+0">03-System Staging - -</td>
<td class="Cell+1">J22</td>
<td class="Cell+2">just typing this line in to see how long my text fields should be</td>
<td class="Cell+3">12</td>
<td class="Cell+4">0</td>
<td class="Cell+5">12</td>
<td class="percent">
<input id="Cell+6" class="input-sm-np pClass" value="0" min="0" max="100" style="background-color: rgb(255, 255, 255);" type="number"><i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">
<input id="Cell+7" class="input-sm-np pClass" value="0" min="0" max="100" style="background-color: rgb(255, 255, 255);" type="number"><i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">
<input id="Cell+8" class="input-sm-np pClass" value="0" min="0" max="100" style="background-color: rgb(255, 255, 255);" type="number"><i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">
<input id="Cell+9" class="input-sm-np pClass" value="0" min="0" max="100" style="background-color: rgb(255, 255, 255);" type="number"><i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">
<input id="Cell+10" class="input-sm-np pClass" value="0" min="0" max="100" style="background-color: rgb(255, 255, 255);" type="number"><i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">
<input id="Cell+11" class="input-sm-np pClass" value="0" min="0" max="100" style="background-color: rgb(255, 255, 255);" type="number"><i class="fa fa-percent" aria-hidden="true"></i>
</td>
<td class="percent">
<input id="Cell+12" class="input-sm-np pClass" value="0" min="0" max="100" style="background-color: rgb(255, 255, 255);" type="number"><i class="fa fa-percent" aria-hidden="true"></i>
</td>
</tr>
</tbody>
</table>