小编use*_*356的帖子

非平滑且不可微的定制损失函数张量流

  1. 在tensorflow中,你可以使用非平滑函数作为损失函数,例如分段(或使用if-else)?如果你不能,为什么你可以使用ReLU?

  2. 在这个链接 SLIM中 ,它说

"例如,我们可能希望最大限度地减少对数损失,但我们感兴趣的指标可能是F1得分,或交叉点超过联盟得分(不可区分,因此不能用作损失)."

它是否意味着"不可区分",例如设置问题?因为对于ReLU,在0点,它是不可区分的.

  1. 如果您使用这种定制的损耗功能,您是否需要自己实现渐变?或者tensorflow可以自动为您完成吗?我检查了一些保留的损失函数,它们没有为它们的损失函数实现梯度.

tensorflow

16
推荐指数
2
解决办法
4031
查看次数

C编程指针char数组

以下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)

c arrays string pointers

2
推荐指数
1
解决办法
1914
查看次数

标签 统计

arrays ×1

c ×1

pointers ×1

string ×1

tensorflow ×1