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

oneflow与pytorch一点算子在int类型上的区别 #6247

Closed
xiezipeng-ML opened this issue Sep 12, 2021 · 2 comments
Closed

oneflow与pytorch一点算子在int类型上的区别 #6247

xiezipeng-ML opened this issue Sep 12, 2021 · 2 comments
Labels

Comments

@xiezipeng-ML
Copy link
Contributor

tensor.abs:

x = torch.tensor([1,-2,3,-4],dtype=torch.int64)
x.abs()
tensor([1, 2, 3, 4])
x = flow.tensor([1,-2,3,-4],dtype=flow.int64)
x.abs()
E0912 21:22:50.176399 3927826 maybe.h:276]
File "/home/xiezipeng/oneflow/oneflow/core/eager/opkernel_instruction_type.cpp", line 449, in Infer
operand->mut_opkernel()->ChooseOpKernel( operand->inputs(), operand->outputs(), operand->consistent_tensor_infer_result())
File "/home/xiezipeng/oneflow/oneflow/user/kernels/stateful_local_opkernel.cpp", line 446, in ChooseOpKernel
user_op::UserOpRegistryMgr::Get().GetOpKernelRegistryResult(op_type_name, *reg_ctx_)
Cannot find the kernel matching Current OperatorConf.
The Info of OperatorConf are
op_name: abs2
op_type_name: abs
DeviceType_Name: kCPU
DataType_Name of x_0: kInt64
DataType_Name of y_0: kInt64
op_kernels_not_found_debug_str: "(((device_tag == gpu [False]) and (data_type of tensor 'x' == kFloat)) and (data_type of tensor 'y' == kFloat))"
op_kernels_not_found_debug_str: "(((device_tag == gpu [False]) and (data_type of tensor 'x' == kDouble)) and (data_type of tensor 'y' == kDouble))"
op_kernels_not_found_debug_str: "(((device_tag == gpu [False]) and (data_type of tensor 'x' == kFloat16)) and (data_type of tensor 'y' == kFloat16))"
op_kernels_not_found_debug_str: "(((device_tag == cpu [True]) and (data_type of tensor 'x' == kFloat [False])) and (data_type of tensor 'y' == kFloat))"
op_kernels_not_found_debug_str: "(((device_tag == cpu [True]) and (data_type of tensor 'x' == kDouble [False])) and (data_type of tensor 'y' == kDouble))"
F0912 21:22:50.178730 3927826 opkernel_instruction_type.cpp:602] Check failed: MaybeIsOk(LocalCallOpKernelUtil::Infer(instruction))
*** Check failure stack trace: ***
@ 0x7f59a6f44d5d google::LogMessage::Fail()
@ 0x7f59a6f46b04 google::LogMessage::SendToLog()
@ 0x7f59a6f4488d google::LogMessage::Flush()
@ 0x7f59a6f47469 google::LogMessageFatal::~LogMessageFatal()
@ 0x7f59a3a7acd3 oneflow::vm::LocalCallOpKernelInstructionType::Compute()
@ 0x7f59a42ad446 oneflow::vm::CpuStreamType::Compute()
@ 0x7f59a42d469e oneflow::vm::StreamType::Run()
@ 0x7f59a42e24bf oneflow::vm::VirtualMachine::DispatchAndPrescheduleInstructions()
@ 0x7f59a42e304e oneflow::vm::VirtualMachine::Schedule()
@ 0x7f59a42c6454 oneflow::OneflowVM::Loop()
@ 0x7f5997b4519d execute_native_thread_routine
@ 0x7f59f9208609 start_thread
@ 0x7f59f912f293 clone
@ (nil) (unknown)
Aborted (core dumped)

tensor.mean:

x = torch.tensor([1,2,3,4],dtype=torch.int32)
x.mean()
Traceback (most recent call last):
File "", line 1, in
RuntimeError: Can only calculate the mean of floating types. Got Long instead.
x = flow.tensor([1,2,3,4],dtype=flow.int32)
x.mean()
tensor(0, dtype=oneflow.int32)

@doombeaker
Copy link
Contributor

第一个问题是缺少对应的 kernel 注册。
第二个是没有对应检查。

两个问题都比较简单(第一个确认,第二个没完全确认),既和 user op/kernel 有关系,又只是完整 user op 中的很小一个环节。
适合想借任务机会了解 user op/kernel 的人练手,有哪位想主动认领的可以留言,然后和我沟通下怎么做(也可以不用直接和我沟通,本贴回复后,直接去 #4936 issue 更新记录就好)

@MARD1NO
Copy link
Contributor

MARD1NO commented Sep 27, 2021

#6293 该PR已解决

@MARD1NO MARD1NO closed this as completed Sep 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants