def feed_input(self, ref, data): if not isinstance(ref, nt.TensorReference): raise TypeError("Expected argument one to " "be TensorReference. " "Received output type {}".format( type(ref).__name__)) if isinstance(data, list): inputs = [] for datum in data: inputs.append(nt.TensorCPU(datum)) self._pipe.SetExternalTensorInput(ref.name, inputs) else: inp = nt.TensorListCPU(data) self._pipe.SetExternalTLInput(ref.name, inp)
def feed_input(self, ref, data): """Bind the NumPy array to a tensor produced by ExternalSource operator.""" if not self._built: raise RuntimeError("Pipeline must be built first.") if not isinstance(ref, nt.TensorReference): raise TypeError("Expected argument one to " "be TensorReference. " "Received output type {}".format( type(ref).__name__)) if isinstance(data, list): inputs = [] for datum in data: inputs.append(nt.TensorCPU(datum)) self._pipe.SetExternalTensorInput(ref.name, inputs) else: inp = nt.TensorListCPU(data) self._pipe.SetExternalTLInput(ref.name, inp)