示例#1
0
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
示例#2
0
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)
示例#3
0
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)
示例#4
0
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
示例#5
0
def random_normal_variable(shape,
                           mean,
                           scale,
                           dtype=None,
                           name=None,
                           seed=None):
    return execution_tree.variable(
        phylanx_random_normal_variable(shape, mean, scale))
示例#6
0
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)
示例#9
0
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)
示例#10
0
def dtype_(x):
    return execution_tree.variable(x).dtype
示例#11
0
def variable(value, dtype=None, name=None):
    return execution_tree.variable(
        np.array(value, dtype=dtype), dtype=dtype, name=name)
示例#12
0
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)
示例#13
0
def phytype(x):
    return execution_tree.variable(x).dtype
示例#14
0
def variable(value):
    return execution_tree.variable(np.float64(value))
示例#15
0
def dtype(x):
    if isinstance(x, execution_tree.variable):
        return x.dtype
    return execution_tree.variable(x, dtype).dtype