我围绕tf.layers.Conv2D构建了一个包装器。我想在图中将层权重明确定义为张量,然后将其添加到层中。我想在训练阶段多次使用权重。
类似的东西:
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.container {
position: relative;
width: 100%;
}
.container img {
width: 100%;
height: auto;
right: 0;
top: 0;
}
button {
position: absolute;
top: 45%;
width: 23vw;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
background-color: #555;
color: white;
font-size: calc(0.5rem + 1vw);
padding: 12px 24px;
border: none;
cursor: pointer;
border-radius: 5px;
text-align: center;
}
.container .btn {
left: 50%;
}
.container .btt {
left: 24%;
}
.container .btc {
left: 76%;
}
.container .btn:hover {
background-color: white;
color: black;
}
.container .btt:hover {
background-color: white;
color: black;
}
.container .btc:hover {
background-color: white;
color: black;
}
</style>
</head>
<body>
<div class="container">
<img src="some img" alt="" class="alignnone size-full wp-image-1660" />
<a href="some ref"><button class="btn">ER DU ARRANGØR?</button></a>
<a href="some ref"><button class="btt">ER DU MARKEDSFØRER?</button></a>
<a href="some ref"><button class="btc">KONTAKT OSS!</button></a></div>
</body>
</html>
layer_weights = tf.get_variable(name,shape)
我想知道应该在自定义层的构建函数中编写什么以将层权重设置为预定义的张量。
我正在按照以下步骤编写“自定义层”: https://keras.io/layers/writing-your-own-keras-layers/