[constant_op.constant(1, shape=[2]), [0, unknown]])
self.assertEqual([6, None], padded.get_shape().as_list())
+ # Zero padding on a known dimension.
+ inp = array_ops.placeholder(dtypes.int32, [None, None, 20])
+ padded = array_ops.pad(inp, [[0, 0], [0, unknown], [0, 0]])
+ self.assertEqual([None, None, 20], padded.get_shape().as_list())
+
def testScalars(self):
paddings = np.zeros((0, 2), dtype=np.int32)
inp = np.asarray(7)
and paddings_constant is not None):
new_shape = []
for padding, dim in zip(paddings_constant, input_shape.as_list()):
- if padding is None or dim is None or not all(padding):
+ if padding is None or dim is None or any((x is None for x in padding)):
new_shape.append(None)
else:
new_shape.append(sum(padding) + dim)