Typescript 模型不';不检测张量,也不检测它们';可再培训
因此,我正在尝试使用TensorFlow(使用npm包:Typescript 模型不';不检测张量,也不检测它们';可再培训,typescript,tensorflow,machine-learning,Typescript,Tensorflow,Machine Learning,因此,我正在尝试使用TensorFlow(使用npm包:@TensorFlow/tfjs节点^3.3.0)进行机器学习,代码如下: const model=Tensor.sequential(); add(Tensor.layers.inputLayer({inputShape:[1]})); compile({loss:“meansquaredrror”,优化器:“sgd”}); 常数xs=张量。张量([1,2,3]); 常数ys=张量。张量([4,5,6]); fit(xs,ys,{epoc
@TensorFlow/tfjs节点^3.3.0
)进行机器学习,代码如下:
const model=Tensor.sequential();
add(Tensor.layers.inputLayer({inputShape:[1]}));
compile({loss:“meansquaredrror”,优化器:“sgd”});
常数xs=张量。张量([1,2,3]);
常数ys=张量。张量([4,5,6]);
fit(xs,ys,{epochs:5})。然后(()=>{
//随便
});
我得到了以下错误:
Error: variableGrads() expects at least one of the input variables to be trainable, but none of the 0 variables is trainable.
我试着把张量转换成变量,但没有成功
为什么会发生错误以及如何修复错误