TensorFlow.js 模型结构可视化 - HTML 展示教程
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@3.11.0/dist/tf.js"></script>
<script>
// 加载模型
async function loadModel() {
const model = await tf.loadLayersModel('path/to/model/model.json');
<pre><code> // 获取模型摘要
const summary = model.summary();
// 在HTML中显示模型摘要
const summaryElement = document.getElementById('model-summary');
summaryElement.innerHTML = summary;
}
window.onload = loadModel;
</code></pre>
</script>
</head>
<body>
<h1>TensorFlow.js 模型结构</h1>
<div id="model-summary"></div>
</body>
</html>
原文地址: https://www.cveoy.top/t/topic/pKHM 著作权归作者所有。请勿转载和采集!