Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add randint #5718

Merged
merged 109 commits into from
Aug 27, 2021
Merged

add randint #5718

merged 109 commits into from
Aug 27, 2021

Conversation

Kevin-XiongC
Copy link
Contributor

@Kevin-XiongC Kevin-XiongC commented Aug 4, 2021

image

@Kevin-XiongC Kevin-XiongC marked this pull request as ready for review August 4, 2021 09:12
>>> import numpy as np
>>> generator = flow.Generator()
>>> generator.manual_seed(0)
>>> flow.randint(10,(1,10),generator=generator)

This comment was marked as resolved.

(user_op::HobDeviceTag() == "gpu"));

REGISTER_GPU_RANDINT_KERNEL
} // namespace oneflow

This comment was marked as resolved.

@hjchen2 hjchen2 requested a review from VertexC August 4, 2021 09:36
high: flow.int32,
size: tuple,
generator: flow.Generator = None,
dtype: flow.dtype = flow.int32,

This comment was marked as resolved.

.Output("out")
.Attr<int64_t>("low")
.Attr<int64_t>("high")
.Attr<int64_t>("seed", -1)

This comment was marked as resolved.

return Maybe<void>::Ok();
});

} // namespace oneflow

This comment was marked as resolved.

Comment on lines 64 to 73
def randint(
low: flow.int64 = 0,
high: Union[int, tuple] = None,
size: tuple = None,
generator: flow.Generator = None,
dtype: flow.dtype = flow.int64,
layout=None,
device: flow.device = flow.device("cpu"),
requires_grad: bool = False,
) -> flow.Tensor:

This comment was marked as resolved.

@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 27, 2021 02:42
@oneflow-ci-bot oneflow-ci-bot self-requested a review August 27, 2021 03:57
@github-actions
Copy link
Contributor

CI failed, removing label automerge

@oneflow-ci-bot oneflow-ci-bot removed their request for review August 27, 2021 05:38
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 27, 2021 07:38
@Kevin-XiongC Kevin-XiongC requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 27, 2021 07:49
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 27, 2021 09:35
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot August 27, 2021 11:57
@github-actions
Copy link
Contributor

Speed stats:
GPU Name: GeForce GTX 1080 

OneFlow resnet50 time: 128.1ms (= 6405.2ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 141.0ms (= 7047.8ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 1.10 (= 141.0ms / 128.1ms)

OneFlow resnet50 time: 74.6ms (= 3730.1ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 84.5ms (= 4222.8ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 1.13 (= 84.5ms / 74.6ms)

OneFlow resnet50 time: 47.2ms (= 2361.6ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 58.0ms (= 2898.3ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 1.23 (= 58.0ms / 47.2ms)

OneFlow resnet50 time: 40.1ms (= 2007.3ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 47.8ms (= 2389.2ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 1.19 (= 47.8ms / 40.1ms)

OneFlow resnet50 time: 43.2ms (= 2161.7ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 44.7ms (= 2237.3ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 1.03 (= 44.7ms / 43.2ms)

OneFlow resnet50 time: 145.6ms (= 7278.5ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 150.5ms (= 7524.7ms / 50, input_shape=[16, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 1.03 (= 150.5ms / 145.6ms)

OneFlow resnet50 time: 94.4ms (= 4717.7ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 93.0ms (= 4651.0ms / 50, input_shape=[8, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 0.99 (= 93.0ms / 94.4ms)

OneFlow resnet50 time: 69.9ms (= 3493.9ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 67.1ms (= 3356.0ms / 50, input_shape=[4, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 0.96 (= 67.1ms / 69.9ms)

OneFlow resnet50 time: 62.7ms (= 3135.5ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 56.9ms (= 2847.3ms / 50, input_shape=[2, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 0.91 (= 56.9ms / 62.7ms)

OneFlow resnet50 time: 54.2ms (= 2710.8ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
OneFlow GPU used (rank 0): 0 MiB
PyTorch resnet50 time: 49.5ms (= 2474.1ms / 50, input_shape=[1, 3, 224, 224], backward is enabled)
PyTorch GPU used (rank 0, estimated): 0 MiB
Relative speed: 0.91 (= 49.5ms / 54.2ms)

@Flowingsun007 Flowingsun007 merged commit aadbb46 into master Aug 27, 2021
@Flowingsun007 Flowingsun007 deleted the dev-randint branch August 27, 2021 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants