我想在对象数组上添加filter
。我尝试这个:
this.projects
.pipe(
map(arr => {
console.error(arr);
arr.filter(r => r.name == 'x')
})
)
.subscribe(result => console.log('Filter results:', result))
我的console.error
返回数组,但是当我在console.log
中subscribe
时,我有undefined
。你能帮我吗?
答案 0 :(得分:5)
您应该在with tf.Session(graph=tf.Graph()) as sess:
saver = tf.train.import_meta_graph(<.meta file>)
saver.restore(sess, <checkpoint>)
output_graph_def = tf.graph_util.convert_variables_to_constants(
sess,
tf.get_default_graph().as_graph_def(),
[comma separated output nodes name]
)
# Saving "output_graph_def " in a file and generate frozen graph.
with tf.gfile.GFile('frozen_graph.pb', "wb") as f:
f.write(output_graph_def.SerializeToString())
中使用内置Tensorflow freeze_graph API运算符,而不要使用graph_def.ParseFromString("frozen_graph.pb")
Array.filter
答案 1 :(得分:5)
尽管我更喜欢@Bear Nithi的解决方案,但我将向您展示代码中的错误。好吧,您应该在var result = list.GroupBy(x => new { x.Id, x.Date.Date }) // group by ID and date
.Select(x =>
// get the first one in each group
x.First())
.ToList();
通话中return arr.filter(r => r.name == 'x')
,如下所示:
map()