我想在TensorFlow中编写RMS池层。这就像<?php
require "conn.php";
require "helper.php";
$call = $_POST["call"]; // this should return sendfile
if($_FILES["uploadedfile"]["name"]) {
.....
}
?>
,但不是简单的平均值,而应计算RMS平均值。
我最初想用numpy写这个;我不关心它在GPU上运行(但后来我想写一个GPU版本)
答案 0 :(得分:1)
尝试
const { writeFile, rename, } = require('fs');
function writeFileTransactional (path, content, cb) {
// The replacement file must be in the same directory as the
// destination because rename() does not work across device
// boundaries.
// This simple choice of replacement filename means that this
// function must never be called concurrently with itself for the
// same path value. Also, properly guarding against other
// processes tyring to use the same temporary path would make this
// function more complicated. If that is a concern, a proper
// temporary file strategy should be used. However, this
// implementation ensures that any files left behind during an
//unclean termination will be cleaned up on a future run.
let temporaryPath = `${path}.new`;
writeFile(temporaryPath, content, function (err) {
if (err) {
return cb(err);
}
rename(temporaryPath, path, cb);
});
};
请注意,l_2池是常用的,而不是RMS池。