在tensorflow中,你可以使用非平滑函数作为损失函数,例如分段(或使用if-else)?如果你不能,为什么你可以使用ReLU?
在这个链接 SLIM中 ,它说
"例如,我们可能希望最大限度地减少对数损失,但我们感兴趣的指标可能是F1得分,或交叉点超过联盟得分(不可区分,因此不能用作损失)."
它是否意味着"不可区分",例如设置问题?因为对于ReLU,在0点,它是不可区分的.
以下C程序将打印最短和最长的字符串as t[0]和t[n-1].但是,当我运行此代码时,它表示存在内存问题.我的代码出了什么问题?
问题是最后两行,带有"strcpy".
#include <stdio.h>
#include <string.h>
void fx (char* t[], int n);
int main(void)
{
char* t[] = {"horse", "elephant", "cat", "rabbit"};
int n;
n = sizeof( t )/ sizeof( t[0] );
fx(t, n);
printf("shortest is %s, longest is %s\n", t[0], t[n-1]);
}
void fx (char* t[], int n)
{
char st[50], lt[50];
strcpy(lt,t[0]);
strcpy(st,t[0]);
for (int i=0; i<n; i++)
{
if (strlen(t[i]) < strlen(st))
strcpy(st,t[i]);
if (strlen(t[i]) > strlen(lt))
strcpy(lt,t[i]);
}
strcpy( t[0], st);
strcpy( …Run Code Online (Sandbox Code Playgroud)