code: def test_transform_function_new_field_batched(scalar_dataset):
      def double_float64(sample):
          sample["new_float64"] = sample["float64"] * 2
          del sample["float64"]
          return sample
  
      with make_batch_reader(
          scalar_dataset.url,
          reader_pool_type="dummy",
          transform_spec=TransformSpec(
              double_float64,
              [("new_float64", np.float64, (), False)],
              ["float64"],
          ),
      ) as reader:
          row_tensors = tf_tensors(reader)
          with _tf_session() as sess:
              actual = sess.run(row_tensors)
  
          for actual_id, actual_float64 in zip(
              actual.id, actual.new_float64
          ):
              original_sample = next(
                  d for d in scalar_dataset.data if d["id"] == actual_id
              )
              expected = original_sample["float64"] * 2
              np.testing.assert_equal(expected, actual_float64)
  
imports: from __future__ import division
  import datetime
  from calendar import timegm
  from collections import namedtuple
  from contextlib import contextmanager
  from decimal import Decimal
  from functools import wraps
  import inspect
  import numpy
  from packaging import version
  import pytest
  import tensorflow.compat.v1
  from unittest import mock
  from petastorm import make_reader, make_batch_reader, TransformSpec
  from petastorm.ngram import NGram
  from petastorm.tests.test_common import TestSchema
  from petastorm.tf_utils import _sanitize_field_tf_types, _numpy_to_tf_dtypes, _schema_to_tf_dtypes, tf_tensors, _ngrams_generator, _unflatten_and_set_shape
  from petastorm.unischema import Unischema, UnischemaField
label_desc: Use image node_id 20 for calling a global function with example usage: test_transform_function_new_field_batched(scalar_dataset) and returns: sample