# Convert [data[0], data[1], ...] separately to tensorflow
# TODO(irving): Remove list() once we handle maps correctly
xs = list(map(constant_op.constant, data))
- # Pack back into a single tensorflow tensor
+ # Stack back into a single tensorflow tensor
c = array_ops.stack(xs)
self.assertAllEqual(c.eval(), data)
for shape in (2,), (3,), (2, 3), (3, 2), (4, 3, 2):
for dtype in [np.bool, np.float32, np.int32, np.int64]:
data = np.random.randn(*shape).astype(dtype)
- # Pack back into a single tensorflow tensor directly using np array
+ # Stack back into a single tensorflow tensor directly using np array
c = array_ops.stack(data)
# This is implemented via a Const:
self.assertEqual(c.op.type, "Const")
array_ops.stack(t, axis=-3)
-class AutomaticPackingTest(test.TestCase):
+class AutomaticStackingTest(test.TestCase):
def testSimple(self):
with self.test_session(use_gpu=True):
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
-"""Functional tests for Unpack Op."""
+"""Functional tests for Unstack Op."""
from __future__ import absolute_import
from __future__ import division
data = np.random.randn(*shape).astype(dtype)
# Convert data to a single tensorflow tensor
x = constant_op.constant(data)
- # Unpack into a list of tensors
+ # Unstack into a list of tensors
cs = array_ops.unstack(x, num=shape[0])
self.assertEqual(type(cs), list)
self.assertEqual(len(cs), shape[0])
data = np.random.randn(*shape).astype(dtype)
# Convert data to a single tensorflow tensor
x = constant_op.constant(data)
- # Unpack into a list of tensors
+ # Unstack into a list of tensors
cs = array_ops.unstack(x, num=shape[0])
self.assertEqual(type(cs), list)
self.assertEqual(len(cs), shape[0])