oneflow icon indicating copy to clipboard operation
oneflow copied to clipboard

inconsistent behavior between oneflow.randint and torch.randint

Open clackhan opened this issue 3 years ago • 0 comments
trafficstars

pytorch version: 1.12.1+cu102 oneflow:

version: 0.8.1+cu112.git.c0811b327a
git_commit: c0811b327a
cmake_build_type: Debug
rdma: False
mlir: False
>>> import oneflow as flow
>>> x = flow.randint(3, 9, (1,))
>>> y = flow.randint(x[0] - 2, x[0], (1,))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: randint(): received an invalid combination of arguments. The valid signatures are:
	*0: Tensor (Int64 low, Int64 high, Shape size, *, DataType dtype=None, Device device=None, Generator generator=None, Bool requires_grad=False)
	*1: Tensor (Int64 high, Shape size, *, DataType dtype=None, Device device=None, Generator generator=None, Bool requires_grad=False)
	*2: Tensor (Int64 low, Int64 high, Shape size, *, Placement placement, SbpList sbp, DataType dtype=None, Generator generator=None, Bool requires_grad=False)
	*3: Tensor (Int64 high, Shape size, *, Placement placement, SbpList sbp, DataType dtype=None, Generator generator=None, Bool requires_grad=False)
>>> import torch
>>> x = torch.randint(3, 9, (1,))
>>> y = torch.randint(x[0] - 2, x[0], (1,))
>>> y
tensor([5])
>>>

clackhan avatar Sep 19 '22 02:09 clackhan