在iOS上我试图加载张量流图,我已经使用convert_variables_to_constants
冻结,但是我得到了:
No OpKernel was registered to support Op 'Switch' with these attrs. Registered devices: [CPU], Registered kernels:
device='GPU'; T in [DT_FLOAT]
device='GPU'; T in [DT_INT32]
device='GPU'; T in [DT_BOOL]
device='GPU'; T in [DT_STRING]
device='CPU'; T in [DT_INT32]
device='CPU'; T in [DT_FLOAT]
[[Node: dropout6/cond/Switch = Switch[T=DT_BOOL](Placeholder_2, Placeholder_2)]]
如果然后在图表上调用optimize_for_inference
并尝试加载,我会得到:
Input 0 of node dropout6/cond/dropout/random_uniform/max was passed bool from dropout6/cond/Switch:1 incompatible with expected INVALID.
这就是Placeholder_2
节点的样子:
name: "Placeholder_2"
op: "Const"
attr {
key: "dtype"
value {
type: DT_BOOL
}
}
attr {
key: "value"
value {
tensor {
dtype: DT_BOOL
tensor_shape {
}
bool_val: false
}
}
}
这就是Switch节点的样子:
name: "dropout6/cond/Switch"
op: "Switch"
input: "Placeholder_2"
input: "Placeholder_2"
attr {
key: "T"
value {
type: DT_BOOL
}
}
并且在优化之后我们有:
name: "dropout6/cond/dropout/random_uniform/max"
op: "Const"
input: "dropout6/cond/Switch:1"
attr {
key: "dtype"
value {
type: DT_FLOAT
}
}
attr {
key: "value"
value {
tensor {
dtype: DT_FLOAT
tensor_shape {
}
float_val: 1.0
}
}
}
有关
答案 0 :(得分:0)