@@ -326,15 +326,14 @@ class Profiler:
326326
327327 import paddle
328328 import paddle.profiler as profiler
329- import numpy as np
330329
331330 class RandomDataset(paddle.io.Dataset):
332331 def __init__(self, num_samples):
333332 self.num_samples = num_samples
334333
335334 def __getitem__(self, idx):
336- image = np.random.random( [100]).astype( 'float32')
337- label = np.random. randint(0, 10 - 1, (1, )).astype( 'int64')
335+ image = paddle.rand(shape= [100], dtype= 'float32')
336+ label = paddle. randint(0, 10, shape=[1], dtype= 'int64')
338337 return image, label
339338
340339 def __len__(self):
@@ -534,7 +533,7 @@ def step(self, num_samples: Optional[int]=None):
534533
535534 Args:
536535 num_samples (int|None, optional): Specifies the batch size of every step of the model
537- that is used to compute throughput when timer_only is True. Default: None.
536+ that is used to compute throughput when timer_only is True. Default: None.
538537
539538 Examples:
540539 .. code-block:: python
@@ -584,11 +583,12 @@ def step_info(self, unit=None):
584583
585584 Args:
586585 unit (string, optional): The unit of input data is only used When `num_samples`
587- of `step()` is specified as a number. For example, when it is `images`, the unit
588- of throughput is `images/s`. Default: None, the unit of throughput is `samples/s`.
586+ of `step()` is specified as a number. For example, when it is `images`, the unit
587+ of throughput is `images/s`. Default: None, the unit of throughput is `samples/s`.
589588
590589 Returns:
591590 string: A string representing the statistic.
591+
592592 Examples:
593593 .. code-block:: python
594594 :name: code-example-timer2
0 commit comments