How to use the ptype.Bool function in ptype

To help you get started, we’ve selected a few ptype examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github iskandr / parakeet / llvm_runtime.py View on Github external
def scalar_to_generic_value(x, t):
  if isinstance(t, ptype.FloatT):
    return GenericValue.real(dtype_to_lltype(t.dtype), x)
  elif t == ptype.Bool:
    return GenericValue.int(int8_t, x)
  else:
    assert isinstance(t, ptype.IntT)
    # assume it's an integer
    return GenericValue.int(dtype_to_lltype(t.dtype), x)
github iskandr / parakeet / llvm_compiled_fn.py View on Github external
def scalar_to_generic_value(x, t):
  if isinstance(t, ptype.FloatT):
    return GenericValue.real(dtype_to_lltype(t.dtype), x)
  elif t == ptype.Bool:
    return GenericValue.int(int8_t, x)
  else:
    assert isinstance(t, ptype.IntT)
    # assume it's an integer
    return GenericValue.int(dtype_to_lltype(t.dtype), x)