from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf from tensorflow_transform import analyzers from tensorflow_transform import test_case _NP_TYPES = (np.float32, np.float64, np.int32, np.int64) _SUM_TEST = dict( testcase_name='Sum', combiner=analyzers.NumPyCombiner(np.sum, output_dtypes=[np.int64]), batches=[ (np.array([1, 2, 3, 4, 5, 6]), ), (np.array([1, 2, 3, 4, 5, 6]), ), ], expected_outputs=[np.array([2, 4, 6, 8, 10, 12])], ) _SUM_SCALAR_TEST = dict( testcase_name='SumScalar', combiner=analyzers.NumPyCombiner(np.sum, output_dtypes=[np.int64]), batches=[ (np.array(1), ), (np.array(2), ), ], expected_outputs=[np.array(3)],
import pickle # GOOGLE-INITIALIZATION import numpy as np import tensorflow as tf from tensorflow_transform import analyzers from tensorflow_transform import test_case _NP_TYPES = (np.float32, np.float64, np.int32, np.int64) _SUM_TEST = dict( testcase_name='Sum', combiner=analyzers.NumPyCombiner(fn=np.sum, default_accumulator_value=0, output_dtypes=[np.int64], output_shapes=[None]), batches=[ (np.array([1, 2, 3, 4, 5, 6]), ), (np.array([1, 2, 3, 4, 5, 6]), ), ], expected_outputs=[np.array([2, 4, 6, 8, 10, 12])], ) _SUM_SCALAR_TEST = dict( testcase_name='SumScalar', combiner=analyzers.NumPyCombiner(fn=np.sum, default_accumulator_value=0, output_dtypes=[np.int64], output_shapes=[None]), batches=[
import pickle # GOOGLE-INITIALIZATION import numpy as np import tensorflow as tf from tensorflow_transform import analyzers from tensorflow_transform import test_case _NP_TYPES = (np.float32, np.float64, np.int32, np.int64) _SUM_TEST = dict( testcase_name='Sum', combiner=analyzers.NumPyCombiner(np.sum, output_dtypes=[np.int64], output_shapes=[(None, )]), batches=[ (np.array([1, 2, 3, 4, 5, 6]), ), (np.array([1, 2, 3, 4, 5, 6]), ), ], expected_outputs=[np.array([2, 4, 6, 8, 10, 12])], ) _SUM_SCALAR_TEST = dict( testcase_name='SumScalar', combiner=analyzers.NumPyCombiner(np.sum, output_dtypes=[np.int64], output_shapes=[(None, )]), batches=[ (np.array(1), ),