docstr: Tests if packing and unpacking of the whole dataset is an identity.
docstr_tok: ["Tests","if","packing","and","unpacking","of","the","whole","dataset","is","an","identity","."]
code: def test_pack_unpack(self, input):
      """
      Tests if packing and unpacking of the whole dataset is an identity.
      """
      (schema, contents, num_records) = input
  
      dataset_fields = schema.field_names()
  
      for pack_to_single_shared_ptr in (True, False):
          net = core.Net("pack_unpack_net")
          batch = NewRecord(net, contents)
          FeedRecord(batch, contents)
  
          packed = net.PackRecords(
              batch.field_blobs(),
              1,
              fields=dataset_fields,
              pack_to_single_shared_ptr=pack_to_single_shared_ptr,
          )
  
          unpacked = packed.UnPackRecords(
              [], len(dataset_fields), fields=dataset_fields
          )
  
          workspace.RunNetOnce(net)
  
          for initial_tensor, unpacked_tensor in zip(
              batch.field_blobs(), unpacked
          ):
              npt.assert_array_equal(
                  workspace.FetchBlob(initial_tensor),
                  workspace.FetchBlob(unpacked_tensor),
              )
  
imports: import functools
  import operator
  import string
  import hypothesis.strategies
  import numpy
  import numpy.testing
  from caffe2.python import core, dataset, workspace
  from caffe2.python.dataset import Const
  from caffe2.python.schema import FeedRecord, FetchRecord, Field, List, Map, NewRecord, Scalar, Struct, from_blob_list
  from caffe2.python.test_util import TestCase
  from hypothesis import given
label_desc: Use image node_id 1 for calling the TestDatasetOps obj's underlying member method code with example usage: obj.test_pack_unpack(input) without return types