From 541bf3af29520b1caee552012da7568afb206632 Mon Sep 17 00:00:00 2001 From: Asthestarsfalll <1186454801@qq.com> Date: Wed, 8 Dec 2021 12:34:25 +0800 Subject: [PATCH] fix(mge/functional): fix one_hot irregular coding style --- imperative/python/megengine/functional/nn.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imperative/python/megengine/functional/nn.py b/imperative/python/megengine/functional/nn.py index c127cc572..36f13632e 100644 --- a/imperative/python/megengine/functional/nn.py +++ b/imperative/python/megengine/functional/nn.py @@ -1587,8 +1587,8 @@ def one_hot(inp: Tensor, num_classes: int) -> Tensor: [0 0 1 0] [0 0 0 1]] """ - zeros_tensor = zeros(list(inp.shape) + [num_classes], inp.dtype, inp.device) - ones_tensor = ones(list(inp.shape) + [1], inp.dtype, inp.device) + zeros_tensor = zeros(list(inp.shape) + [num_classes], dtype=inp.dtype, device=inp.device) + ones_tensor = ones(list(inp.shape) + [1], dtype=inp.dtype, device=inp.device) op = builtin.IndexingSetOneHot(axis=inp.ndim) (result,) = apply(op, zeros_tensor, inp, ones_tensor) -- GitLab