如何将形状为(None,)的张量连接到另一个形状为(None,None)(都具有相同批处理大小)的张量?

时间:2020-09-30 04:00:58

标签: tensorflow

我有多个这样的张量:

[value]
[value]
...
[value] (batch_size=n, shape=(None))

和多个张量:

[value, value]
[value, value]
...
[value, value] (batch_size=n, shape=(None, None))

如何将它们连接成这样?

[value, value, ..., value]
[value, value, ..., value]
...
[value, value, ..., value] (batch_size=n)

1 个答案:

答案 0 :(得分:0)

我用排名第一的Sub CreateSheetsFromAList() Dim MyCell As Range, MyRange As Range Set MyRange = Sheets(4).Range("C6") Set MyRange = Range(MyRange, MyRange.End(xlDown)) Application.ScreenUpdating = False For Each MyCell In MyRange If MyCell.Value = "" Then 'Check for null/empty value cell. GoTo NextOne: 'Go to next MyCell Else Sheets(5).Copy After:=Sheets(Sheets.count) 'creates a new worksheet Sheets(Sheets.count).Name = MyCell.Value ' renames the new worksheet End If NextOne: Next MyCell Application.ScreenUpdating = True MsgBox "Macro is done" 'Insert your own message between the quotations. End Sub 张量解决了这个问题,因为tf.expand_dims要求张量的等级必须相同。