我正在实现自己的keras损失功能.如何访问张量值?
我试过的
def loss_fn(y_true, y_pred):
print y_true
Run Code Online (Sandbox Code Playgroud)
它打印
Tensor("target:0", shape=(?, ?), dtype=float32)
Run Code Online (Sandbox Code Playgroud)
是否有任何keras函数来访问y_true值?
我在两个不同的函数中有两个变量,我想将它们存储在第三个函数中,而不使用全局变量.怎么做?
这样的事情
void function1() {
a = 1;
b = 2;
}
void function2() {
c = 3;
d = 4;
}
void function3 () {
cout << a;
cout << b;
cout << c;
cout << d;
}
Run Code Online (Sandbox Code Playgroud)