Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion mindtorch/_apis/cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
import math
import numpy as np
import mindspore
from mindspore._c_expression import _empty_instance
from mindspore.ops.auto_generate.gen_ops_prim import Empty
import mindtorch
from .._op_prim.cpu import legacy

empty_op = Empty().set_device('CPU')
def empty(size, dtype):
return empty_op(size, dtype=dtype, device='CPU')
if mindtorch.configs.MS27:
return empty_op(size, dtype=dtype, device='CPU')
return _empty_instance(size, dtype=dtype, device='CPU')

def inplace_normal(input, mean, std, generator_):
out = np.random.normal(mean, std, input.shape).astype(mindtorch.dtype2np[input.dtype])
Expand Down