我对GAN 实施中.trainable的声明感到困惑。tf.keras.model
给出以下代码片段(取自此 repo):
class GAN():
def __init__(self):
...
# Build and compile the discriminator
self.discriminator = self.build_discriminator()
self.discriminator.compile(loss='binary_crossentropy',
optimizer=optimizer,
metrics=['accuracy'])
# Build the generator
self.generator = self.build_generator()
# The generator takes noise as input and generates imgs
z = Input(shape=(self.latent_dim,))
img = self.generator(z)
# For the combined model we will only train the generator
self.discriminator.trainable = False
# The discriminator takes generated images as input and determines validity
validity = self.discriminator(img)
# The combined …Run Code Online (Sandbox Code Playgroud) 我想编写一个应用程序,它在我的 google-drive 中生成一个电子表格,其中包含带有 google-app 脚本的用户输入数据。
为此,我有几个 JavaScript 函数,我想一个接一个地执行:
function createSpreadsheet(name){
var ss=SpreadsheetApp.create(name);
var ssID = ss.getID()
}
function writeData(data){
var s = ss.getSheets()[0];
s.getRange('A1').setValue(data);
}
Run Code Online (Sandbox Code Playgroud)
前端脚本通过以下方式调用它们:
<script>
function parse_to_backend(){
var name = document.getElementById("user_name").value;
var data = document.getElementById("user_data").value;
google.script.run.createSpreadsheet(name);
google.script.run.writeData(data);
};
</script>
Run Code Online (Sandbox Code Playgroud)
我怎样才能实现 writeData 知道 ssID 电子表格的 ID (我无法使用 google.script.run 将值返回到前端并将其解析为参数)?
javascript web-applications google-sheets google-apps-script