MCPcopy Create free account
hub / github.com/NVIDIA/FasterTransformer / __call__

Method __call__

examples/tensorflow/decoder/utils/reducer.py:104–117  ·  view source on GitHub ↗

Reduces all input elements. Args: inputs: A list of ``tf.Tensor``. sequence_length: The length of each input, if reducing sequences. Returns: If :obj:`sequence_length` is set, a tuple ``(reduced_input, reduced_length)``, otherwise a reduced ``t

(self, inputs, sequence_length=None)

Source from the content-addressed store, hash-verified

102 return tf.nest.pack_sequence_as(x, reduced)
103
104 def __call__(self, inputs, sequence_length=None):
105 """Reduces all input elements.
106 Args:
107 inputs: A list of ``tf.Tensor``.
108 sequence_length: The length of each input, if reducing sequences.
109 Returns:
110 If :obj:`sequence_length` is set, a tuple
111 ``(reduced_input, reduced_length)``, otherwise a reduced ``tf.Tensor``
112 only.
113 """
114 if sequence_length is None:
115 return self.reduce(inputs)
116 else:
117 return self.reduce_sequence(inputs, sequence_lengths=sequence_length)
118
119 @abc.abstractmethod
120 def reduce(self, inputs):

Callers

nothing calls this directly

Calls 2

reduceMethod · 0.95
reduce_sequenceMethod · 0.95

Tested by

no test coverage detected