目前,我正在获取以下格式的数据:
arr=[
0: {abc:1},
1: {efg:2},
2: {hij:3}
]
我需要以下格式的文件:
arr=[
{name:'abc', value:1},
{name:'efg', value:2},
{name:'hij', value:3}]
答案 0 :(得分:1)
假设arr
具有以下结构,则仅需通过它进行映射并分隔键和值:
var arr = [
{abc:1},
{efg:2},
{hij:3}
]
var result = arr.map(o => {
var k = Object.keys(o)[0];
return {
name: k,
value: o[k]
};
});
console.log(result);
答案 1 :(得分:0)
output_image = tf.depth_to_space(
output_image,
2,
name=None,
data_format='NHWC'
)