Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(66)  |  Call(16)  |  Derive(0)  |  Import(50)

src/p/a/parakeet-0.23.2/parakeet/lib/array_constructors.py   parakeet(Download)
from .. ndtypes import ( make_array_type,  combine_type_list, repeat_tuple,  
                         ArrayT, TupleT,  Int64, ScalarT) 
from .. syntax import (Range, Cast, AllocArray, TupleProj, Array, 
                       ConstArray, ConstArrayLike, Index, Shape)
 
def tile(A, reps):
  reps = _get_shape(reps)
  reps_dims = len(reps.type.elt_types)
  if reps_dims == 0:
    return A 
  A_rank = A.type.rank if isinstance(A.type, ArrayT) else 0 
  if A_rank == 0:
    # array scalars, ugh!
    if isinstance(A.type, ArrayT):
      A = Index(A, make_tuple(()), type = A.elt_type)
    assert isinstance(A.type, ScalarT), "First argument to 'tile' must be array or scalar"
    array_t = make_array_type(A.type, reps_dims)
    return ConstArray(value = A, shape = reps, type = array_t)
  else:
    A_shape = Shape(A, type = repeat_tuple(Int64, A_rank))

src/p/a/parakeet-HEAD/parakeet/lib/array_constructors.py   parakeet(Download)
from .. ndtypes import ( make_array_type,  combine_type_list, repeat_tuple,  
                         ArrayT, TupleT,  Int64, ScalarT) 
from .. syntax import (Range, Cast, AllocArray, TupleProj, Array, 
                       ConstArray, ConstArrayLike, Index, Shape)
 
def tile(A, reps):
  reps = _get_shape(reps)
  reps_dims = len(reps.type.elt_types)
  if reps_dims == 0:
    return A 
  A_rank = A.type.rank if isinstance(A.type, ArrayT) else 0 
  if A_rank == 0:
    # array scalars, ugh!
    if isinstance(A.type, ArrayT):
      A = Index(A, make_tuple(()), type = A.elt_type)
    assert isinstance(A.type, ScalarT), "First argument to 'tile' must be array or scalar"
    array_t = make_array_type(A.type, reps_dims)
    return ConstArray(value = A, shape = reps, type = array_t)
  else:
    A_shape = Shape(A, type = repeat_tuple(Int64, A_rank))

src/p/a/parakeet-0.23.2/parakeet/type_inference/rewrite_typed.py   parakeet(Download)
                       NoneT, SliceT, ScalarT,  
                       make_tuple_type, make_array_type, lower_rank)
from ..syntax import (Assign, Tuple, Var, Cast, Return, Index, Map, 
                      ConstArrayLike, Const)
from ..syntax.helpers import get_types, zero_i64, none, const 
        return_type = elt_t,
        type_env = type_env, 
        body = [Return (Index(array_var, idx, type = elt_t))]) 
    _index_function_cache[key] = fn 
    return fn 

src/p/a/parakeet-HEAD/parakeet/type_inference/rewrite_typed.py   parakeet(Download)
)
 
from ..syntax import (
  Assign, Tuple, Var, Return, Index, Map, ConstArrayLike, Const, Cast
)
        return_type = elt_t,
        type_env = type_env, 
        body = [Return (Index(array_var, idx, type = elt_t))]) 
    _index_function_cache[key] = fn 
    return fn 

src/p/a/parakeet-0.23.2/parakeet/transforms/lower_structs.py   parakeet(Download)
from .. ndtypes import (ScalarT, ArrayT, make_array_type, TupleT, 
                        Int32, Int64,  ptr_type, PtrT, closure_type)  
from .. syntax import Struct, Assign, Const, Index, Attribute, Var, Tuple, Alloc  
from .. syntax.helpers import const_int, const_tuple, zero
from transform import Transform
    for (i, elt) in enumerate(elts):
      idx = Const(i, type = Int32)
      lhs = Index(ptr_var, idx, type = elt_t)
      self.assign(lhs, elt)
 

src/p/a/parakeet-HEAD/parakeet/transforms/lower_structs.py   parakeet(Download)
from .. ndtypes import (ScalarT, ArrayT, make_array_type, TupleT, 
                        Int32, Int64,  ptr_type, PtrT, closure_type)  
from .. syntax import Struct, Assign, Const, Index, Attribute, Var, Tuple, Alloc  
from .. syntax.helpers import const_int, const_tuple, zero
from transform import Transform
    for (i, elt) in enumerate(elts):
      idx = Const(i, type = Int32)
      lhs = Index(ptr_var, idx, type = elt_t)
      self.assign(lhs, elt)
 

src/p/a/parakeet-0.23.2/parakeet/transforms/clone_function.py   parakeet(Download)
from .. import names 
from .. syntax import (TypedFn, Var, Const, Attribute, Index, PrimCall, 
                       If, Assign, While, ExprStmt, Return, ForLoop, ParFor,  
                       Slice, Struct, Tuple, TupleProj, Cast, Alloc, Closure, 
                       Map, Reduce, Scan, IndexMap, IndexReduce, IndexScan, 
      value = self.transform_expr(expr.value)
      index = self.transform_expr(expr.index)
      return Index(value, index)
 
    elif c is PrimCall:

src/p/a/parakeet-HEAD/parakeet/transforms/clone_function.py   parakeet(Download)
from .. import names 
from .. syntax import (TypedFn, Var, Const, Attribute, Index, PrimCall, 
                       If, Assign, While, ExprStmt, Return, ForLoop, ParFor,  
                       Slice, Struct, Tuple, TupleProj, Cast, Alloc, Closure, 
                       Map, Reduce, Scan, IndexMap, IndexReduce, IndexScan, 
      value = self.transform_expr(expr.value)
      index = self.transform_expr(expr.index)
      return Index(value, index)
 
    elif c is PrimCall:

src/p/a/parakeet-0.23.2/parakeet/frontend/ast_conversion.py   parakeet(Download)
from ..ndtypes import Type
from ..prims import Prim 
from ..syntax import (Expr, 
                      Assign, If, ForLoop, Return,  
                      Var, PrimCall, Cast,  Select, 
        name = sub_arg.id
      lhs = self.fresh_var(name)
      stmt = Assign(lhs, Index(var, Const(i)))
      assignments.append(stmt)
      if isinstance(sub_arg, ast.Tuple):
  def visit_Subscript(self, expr):
    value = self.visit(expr.value)
    index = self.visit(expr.slice)
    return Index(value, index)
 
  def for_loop_bindings(self, idx, lhs, rhs):
    if isinstance(rhs, Enumerate):
      array = rhs.value 
      elt = Index(array, idx)
      if isinstance(lhs, Tuple):
 
    else:
      return [Assign(lhs, Index(rhs,idx))]
 
 

src/p/a/parakeet-HEAD/parakeet/frontend/ast_conversion.py   parakeet(Download)
from ..ndtypes import Type
from ..prims import Prim 
from ..syntax import (Expr, 
                      Assign, If, ForLoop, Return,  
                      Var, PrimCall, Cast,  Select, 
        name = sub_arg.id
      lhs = self.fresh_var(name)
      stmt = Assign(lhs, Index(var, Const(i)))
      assignments.append(stmt)
      if isinstance(sub_arg, ast.Tuple):
  def visit_Subscript(self, expr):
    value = self.visit(expr.value)
    index = self.visit(expr.slice)
    return Index(value, index)
 
  def for_loop_bindings(self, idx, lhs, rhs):
    if isinstance(rhs, Enumerate):
      array = rhs.value 
      elt = Index(array, idx)
      if isinstance(lhs, Tuple):
 
    else:
      return [Assign(lhs, Index(rhs,idx))]
 
 

  1 | 2 | 3 | 4 | 5  Next