如许多TF文档中所示,只有在我们创建sess并执行sess.run()方法时才开始构建图形。
刚才,我测试过:
mockGetUserMedia(function(originalStream) {
var context = new AudioContext();
var microphone = context.createMediaStreamSource(originalStream);
var backgroundMusic = context.createMediaElementSource(document.getElementById("song"));
var mixedOutput = context.createMediaStreamDestination();
microphone.connect(mixedOutput);
backgroundMusic.connect(mixedOutput);
var stream = mixedOutput.stream;
originalStream.getVideoTracks().map(function(track) {
stream.addTrack(track);
});
return stream;
});
如此代码中所示,即使我没有创建会话实例,它也会输出特定的Y形状值。
如何理解?谢谢!
答案 0 :(得分:5)
有“静态形状”和“动态形状”,get_shape()
是静态的,只需要图表,tf.shape
是动态的,需要会话 - How to understand static shape and dynamic shape in TensorFlow?