コード例 #1
0
    def test_callable_object(self):
        class Identity(object):
            def __call__(self, other):
                return other

        map_lt = ops.map_fn(Identity(), self.original_lt)
        self.assertLabeledTensorsEqual(map_lt, self.original_lt)
コード例 #2
0
ファイル: ops_test.py プロジェクト: AliMiraftab/tensorflow
  def test_callable_object(self):

    class Identity(object):

      def __call__(self, other):
        return other

    map_lt = ops.map_fn(Identity(), self.original_lt)
    self.assertLabeledTensorsEqual(map_lt, self.original_lt)
コード例 #3
0
ファイル: ops_test.py プロジェクト: sgcm520/tensorflow2
    def test_string(self):
        def fn(entry_lt):
            op = string_ops.string_join([entry_lt, 'world'])
            return core.LabeledTensor(op, [])

        tensor_lt = ops.constant(['hi', 'bye'], axes=['batch'])
        map_lt = ops.map_fn(fn, tensor_lt)
        golden_lt = ops.constant(['hiworld', 'byeworld'], axes=['batch'])

        self.assertLabeledTensorsEqual(map_lt, golden_lt)
コード例 #4
0
ファイル: ops_test.py プロジェクト: Ajaycs99/tensorflow
  def test_string(self):

    def fn(entry_lt):
      op = string_ops.string_join([entry_lt, 'world'])
      return core.LabeledTensor(op, [])

    tensor_lt = ops.constant(['hi', 'bye'], axes=['batch'])
    map_lt = ops.map_fn(fn, tensor_lt)
    golden_lt = ops.constant(['hiworld', 'byeworld'], axes=['batch'])

    self.assertLabeledTensorsEqual(map_lt, golden_lt)
コード例 #5
0
 def test_slice(self):
     map_lt = ops.map_fn(lambda t: core.slice_function(t, {'channel': 1}),
                         self.original_lt)
     slice_lt = core.slice_function(self.original_lt, {'channel': 1})
     self.assertLabeledTensorsEqual(map_lt, slice_lt)
コード例 #6
0
 def test_identity(self):
     map_lt = ops.map_fn(core.identity, self.original_lt)
     self.assertLabeledTensorsEqual(map_lt, self.original_lt)
コード例 #7
0
 def test_name(self):
     map_lt = ops.map_fn(core.identity, self.original_lt)
     self.assertIn('lt_map_fn', map_lt.name)
コード例 #8
0
ファイル: ops_test.py プロジェクト: AliMiraftab/tensorflow
 def test_slice(self):
   map_lt = ops.map_fn(lambda t: core.slice_function(t, {'channel': 1}),
                       self.original_lt)
   slice_lt = core.slice_function(self.original_lt, {'channel': 1})
   self.assertLabeledTensorsEqual(map_lt, slice_lt)
コード例 #9
0
ファイル: ops_test.py プロジェクト: AliMiraftab/tensorflow
 def test_identity(self):
   map_lt = ops.map_fn(core.identity, self.original_lt)
   self.assertLabeledTensorsEqual(map_lt, self.original_lt)
コード例 #10
0
ファイル: ops_test.py プロジェクト: AliMiraftab/tensorflow
 def test_name(self):
   map_lt = ops.map_fn(core.identity, self.original_lt)
   self.assertIn('lt_map_fn', map_lt.name)