到目前为止,我一直在使用Tensorflow-GPU,方法是使用pip和 Cuda 相关软件以及来自Nvidia 网站的Nvidia 软件/驱动程序安装它。最近,我发现 usingconda install tensorflow-gpu还安装了cudatoolkit和cudnn。
那么,这些(由 conda 提供的)与我从 Nvidia 网站下载的那些有什么不同?
在我的第一个(以前的)环境中,conda list显示我只安装了 TensorFlow(来自 PyPi)而没有安装 cudnn/cudatoolkit,但仍然一切正常。
此外,在我跑了一个新的环境conda install tensorflow-gpu,conda list给我tensorflow-GPU已经与一起安装cudatoolkit和cudnn的蟒蛇。而且在这种环境下,一切正常。
那么这是否意味着,只有在我使用 pip 安装 TensorFlow时才需要从 Nvidia 的网站下载和安装 Cuda ?
在C++中,'>>'和'<<'用于在执行输入/输出操作期间进行级联.
有没有什么方法可以在C#中完成这些事情?直到现在,我知道我可以一次输入一个输入并将其分配给变量,例如,在以下代码片段中:
int a,b;
Console.Write("Enter the value of first number: ");
a=Convert.ToInt32(Console.ReadLine());
Console.Write("Enter the value of second number: ");
b=Convert.ToInt32(Console.ReadLine());
Run Code Online (Sandbox Code Playgroud)
而在C++中,同样的事情可以做到:
int a,b;
cout<<"Enter the values of the two numbers: ";
cin>>a>>b;
Run Code Online (Sandbox Code Playgroud) 根据文档,该Reduction参数有 3 个值 - SUM_OVER_BATCH_SIZE、SUM和NONE。
y_true = [[0., 2.], [0., 0.]]
y_pred = [[3., 1.], [2., 5.]]
mae = tf.keras.losses.MeanAbsoluteError(reduction=tf.keras.losses.Reduction.SUM)
mae(y_true, y_pred).numpy()
> 5.5
mae = tf.keras.losses.MeanAbsoluteError()
mae(y_true, y_pred).numpy()
> 2.75
Run Code Online (Sandbox Code Playgroud)
经过各种试验后我可以推断出的计算结果是:-
什么时候REDUCTION = SUM,
Loss = Sum over all samples {(Sum of differences between y_pred and y_target vector of each sample / No of element in y_target of the sample )} = { (abs(3-0) + abs(1-2))/2 } + …