def dtype(x): from phylanx.ast.physl import PhySL if isinstance(x, PhySL.eval_wrapper): return execution_tree.variable(x.code(), dtype).dtype if isinstance(x, execution_tree.variable): return x.dtype return execution_tree.variable(x, dtype).dtype
def variable(value, dtype=None, name=None, constraint=None): if dtype is None: dtype = floatx() from phylanx.ast.physl import PhySL if isinstance(value, PhySL.eval_wrapper): return execution_tree.variable(value.code(), dtype) if isinstance(value, execution_tree.variable): return value return execution_tree.variable(value, dtype=dtype, name=name)
def variable(value, dtype=None, name=None, constraint=None): if dtype is None: dtype = floatx() if constraint is not None: raise TypeError("Constraint is the projection function to be " "applied to the variable after an optimizer update") from phylanx.ast.physl import PhySL if isinstance(value, PhySL.eval_wrapper): return execution_tree.variable(value.code(), dtype) if isinstance(value, execution_tree.variable): return value return execution_tree.variable(value, dtype=dtype, name=name)
def dtype(x, dtype=None): from phylanx.ast.physl import PhySL if isinstance(x, execution_tree.variable): if dtype is not None: return dtype return x.dtype return execution_tree.variable(x, dtype).dtype
def random_normal_variable(shape, mean, scale, dtype=None, name=None, seed=None): return execution_tree.variable( phylanx_random_normal_variable(shape, mean, scale))
def random_uniform_variable(shape, low, high, dtype=None, name=None, seed=None): return execution_tree.variable( phylanx_random_uniform_variable(shape, low, high))
def variable(value, dtype=None, name=None): if dtype is None: dtype = "int64" if isinstance(value, execution_tree.variable): if dtype is not None: value.dtype = dtype if name is not None: value.name = name return value return execution_tree.variable(value, dtype=dtype, name=name)
def variable(value, dtype=None, name=None, constraint=None): if dtype is None: dtype = floatx() if isinstance(value, execution_tree.variable): if dtype is not None: value.dtype = dtype if name is not None: value.name = name return value return execution_tree.variable(value, dtype=dtype, name=name)
def variable(value, dtype=None, name=None, constraint=None): if dtype is None: dtype = "float32" if constraint is not None: raise TypeError("Constraint is the projection function to be " "applied to the variable after an optimizer update") if isinstance(value, execution_tree.variable): if dtype is not None: value.dtype = dtype if name is not None: value.name = name return value return execution_tree.variable(value, dtype=dtype, name=name)
def dtype_(x): return execution_tree.variable(x).dtype
def variable(value, dtype=None, name=None): return execution_tree.variable( np.array(value, dtype=dtype), dtype=dtype, name=name)
def variable(value, dtype=None, name=None, constraint=None): if constraint is not None: raise TypeError("Constraint is the projection function to be " "applied to the variable after an optimizer update") return execution_tree.variable(np.array(value, dtype), dtype)
def phytype(x): return execution_tree.variable(x).dtype
def variable(value): return execution_tree.variable(np.float64(value))
def dtype(x): if isinstance(x, execution_tree.variable): return x.dtype return execution_tree.variable(x, dtype).dtype