Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typescript 模型不';不检测张量,也不检测它们';可再培训_Typescript_Tensorflow_Machine Learning - Fatal编程技术网

Typescript 模型不';不检测张量,也不检测它们';可再培训

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(使用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,{epochs:5})。然后(()=>{
//随便
});
我得到了以下错误:

Error: variableGrads() expects at least one of the input variables to be trainable, but none of the 0 variables is trainable.
我试着把张量转换成变量,但没有成功

为什么会发生错误以及如何修复错误