コード例 #1
0
 def test_multi_feature_single_receiver(self):
     features = {
         'foo': constant_op.constant(5),
         'bar': constant_op.constant(6)
     }
     receiver_tensor = array_ops.placeholder(dtypes.string)
     _ = export.ServingInputReceiver(features, receiver_tensor)
コード例 #2
0
    def serving_input_receiver_with_asset_fn():
      features, receiver_tensor = serving_input_receiver_fn()
      filename = ops.convert_to_tensor(vocab_file_name,
                                       dtypes.string,
                                       name='asset_filepath')
      ops.add_to_collection(ops.GraphKeys.ASSET_FILEPATHS, filename)
      features['bogus_filename'] = filename

      return export.ServingInputReceiver(features, receiver_tensor)
コード例 #3
0
 def test_multi_feature_multi_receiver(self):
     features = {
         'foo': constant_op.constant(5),
         'bar': constant_op.constant(6)
     }
     receiver_tensors = {
         'baz': array_ops.placeholder(dtypes.int64),
         'qux': array_ops.placeholder(dtypes.float32)
     }
     _ = export.ServingInputReceiver(features, receiver_tensors)
コード例 #4
0
 def test_single_feature_single_receiver(self):
     feature = constant_op.constant(5)
     receiver_tensor = array_ops.placeholder(dtypes.string)
     input_receiver = export.ServingInputReceiver(feature, receiver_tensor)
     # single feature is automatically named
     feature_key, = input_receiver.features.keys()
     self.assertEqual('feature', feature_key)
     # single receiver is automatically named
     receiver_key, = input_receiver.receiver_tensors.keys()
     self.assertEqual('input', receiver_key)
コード例 #5
0
 def test_receiver_wrong_type(self):
     feature = constant_op.constant(5)
     receiver_tensor = 'not a tensor'
     with self.assertRaises(ValueError):
         _ = export.ServingInputReceiver(feature, receiver_tensor)
コード例 #6
0
 def test_feature_wrong_type(self):
     feature = 'not a tensor'
     receiver_tensor = array_ops.placeholder(dtypes.string)
     with self.assertRaises(ValueError):
         _ = export.ServingInputReceiver(feature, receiver_tensor)
コード例 #7
0
 def test_multi_feature_multi_receiver(self):
   features = {"foo": constant_op.constant(5),
               "bar": constant_op.constant(6)}
   receiver_tensors = {"baz": array_ops.placeholder(dtypes.int64),
                       "qux": array_ops.placeholder(dtypes.float32)}
   _ = export.ServingInputReceiver(features, receiver_tensors)