def tensor(self, shapes, dtype='float32', device='cpu'):
     """ A wapper function to create C2 tensor filled with random data.
         The name/label of the tensor is returned and it is available
         throughout the benchmark execution phase.
         Args:
             shapes: int or a sequence of ints to defining the shapes of the tensor
             dtype: use the dtypes from numpy
                 (https://docs.scipy.org/doc/numpy/user/basics.types.html)
         Return:
             C2 tensor of dtype
     """
     return self.feed_tensor(benchmark_utils.numpy_random(dtype, *shapes),
                             device)
Beispiel #2
0
 def tensor(self, shapes, dtype='float32'):
     """ A wapper function to create C2 tensor filled with random data.
         The name/label of the tensor is returned and it is available 
         throughout the benchmark execution phase. 
         Args: 
             shapes: int or a sequence of ints to defining the shapes of the tensor
             dtype: use the dtypes from numpy 
                 (https://docs.scipy.org/doc/numpy/user/basics.types.html)
         Return: 
             C2 tensor of dtype 
     """
     blob_name = 'blob_' + str(Caffe2BenchmarkBase.tensor_index)
     workspace.FeedBlob(blob_name, benchmark_utils.numpy_random(dtype, *shapes))
     Caffe2BenchmarkBase.tensor_index += 1
     return blob_name