Creating scalar half tensor from Aten c++ 0.4

In testing various types for an api, I was unable to create a scalar of half type from CPU
(not a typical case)

e.g.
#include “ATen/ATen.h”

using namespace at;
int main() {
auto x=CPU(kHalf).scalarTensor(0.0);
}

libc++abi.dylib: terminating with uncaught exception of type at::Error
Abort trap: 6

Is there a better way to do this?
something like this seems to work:
x=CPU(kFloat).scalarTensor(0.0).toType(kHalf);

Thanks

What is the full stack trace?

lldb ./half
(lldb) target create “./half”
Current executable set to ‘./half’ (x86_64).
(lldb) run
Process 1041 launched: ‘./half’ (x86_64)
libc++abi.dylib: terminating with uncaught exception of type at::Error
Process 1041 stopped

  • thread #1, queue = ‘com.apple.main-thread’, stop reason = signal SIGABRT
    frame #0: 0x00007fff8c708d42 libsystem_kernel.dylib__pthread_kill + 10 libsystem_kernel.dylib__pthread_kill:
    -> 0x7fff8c708d42 <+10>: jae 0x7fff8c708d4c ; <+20>
    0x7fff8c708d44 <+12>: movq %rax, %rdi
    0x7fff8c708d47 <+15>: jmp 0x7fff8c701caf ; cerror_nocancel
    0x7fff8c708d4c <+20>: retq
    Target 0: (half) stopped.
    (lldb) bt
  • thread #1, queue = ‘com.apple.main-thread’, stop reason = signal SIGABRT
    • frame #0: 0x00007fff8c708d42 libsystem_kernel.dylib__pthread_kill + 10 frame #1: 0x00007fff8c7f6457 libsystem_pthread.dylibpthread_kill + 90
      frame #2: 0x00007fff8c66e420 libsystem_c.dylibabort + 129 frame #3: 0x00007fff8b1c294a libc++abi.dylibabort_message + 266
      frame #4: 0x00007fff8b1e7c2f libc++abi.dylibdefault_terminate_handler() + 267 frame #5: 0x00007fff8bcf6713 libobjc.A.dylib_objc_terminate() + 124
      frame #6: 0x00007fff8b1e4d49 libc++abi.dylibstd::__terminate(void (*)()) + 8 frame #7: 0x00007fff8b1e47be libc++abi.dylib__cxa_throw + 121
      frame #8: 0x0000000100209365 libATen.dylibat::Type::fill_(at::Tensor&, at::Scalar) const + 149 frame #9: 0x0000000100208c1f libATen.dylibat::Type::scalarTensor(at::Scalar) const + 191
      frame #10: 0x0000000100002893 halfmain + 57 frame #11: 0x00007fff8c5da235 libdyld.dylibstart + 1