예제 #1
0
파일: pipeline.py 프로젝트: zsef123/DALI
 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)
예제 #2
0
파일: pipeline.py 프로젝트: xdcesc/DALI
 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)