Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
dmlLines = []
script_java = sc._jvm.org.apache.sysml.api.mlcontext.ScriptFactory.dml('')
for layer in layers:
inputMatrices = getInputMatrices(layer)
potentialVar = [
layer.name + '_weight',
layer.name + '_bias',
layer.name + '_1_weight',
layer.name + '_1_bias']
for i in range(len(inputMatrices)):
dmlLines = dmlLines + \
['write(' + potentialVar[i] + ', "' + outDirectory +
'/' + potentialVar[i] + '.mtx", format="binary");\n']
mat = inputMatrices[i].transpose() if (
i == 1 and type(layer) in biasToTranspose) else inputMatrices[i]
py4j.java_gateway.get_method(script_java, "in")(
potentialVar[i], convertToMatrixBlock(sc, mat))
script_str = ''.join(dmlLines)
if script_str.strip() != '':
# Only execute if the script is not empty
script_java.setScriptString(script_str)
ml = sc._jvm.org.apache.sysml.api.mlcontext.MLContext(sc._jsc)
ml.execute(script_java)
def _setInput(self, key, val):
# `in` is a reserved word ("keyword") in Python, so `script_java.in(...)` is not
# allowed. Therefore, we use the following code in which we retrieve a function
# representing `script_java.in`, and then call it with the arguments. This is in
# lieu of adding a new `input` method on the JVM side, as that would complicate use
# from Scala/Java.
if isinstance(val, py4j.java_gateway.JavaObject):
py4j.java_gateway.get_method(self.script_java, "in")(key, val)
else:
py4j.java_gateway.get_method(
self.script_java, "in")(
key, _py2java(
self.sc, val))
Reading a table from a registered catalog with escaping. (`Table` is a reserved keyword).
Dots in e.g. a database name also must be escaped.
::
>>> tab = table_env.from_path("catalogName.`db.Name`.`Table`")
:param path: The path of a table API object to scan.
:type path: str
:return: Either a table or virtual table (=view).
:rtype: pyflink.table.Table
.. seealso:: :func:`use_catalog`
.. seealso:: :func:`use_database`
"""
return Table(get_method(self._j_tenv, "from")(path))
def alias(self, alias):
"""
Assigns an alias for this window that the following
:func:`~pyflink.table.GroupWindowedTable.group_by` and
:func:`~pyflink.table.WindowGroupedTable.select` clause can refer to.
:func:`~pyflink.table.WindowGroupedTable.select` statement can access window properties
such as window start or end time.
:param alias: Alias for this window.
:return: This window.
"""
# type: (str) -> GroupWindow
return GroupWindow(get_method(self._java_window, "as")(alias))
def _setInput(self, key, val):
# `in` is a reserved word ("keyword") in Python, so `script_java.in(...)` is not
# allowed. Therefore, we use the following code in which we retrieve a function
# representing `script_java.in`, and then call it with the arguments. This is in
# lieu of adding a new `input` method on the JVM side, as that would complicate use
# from Scala/Java.
if isinstance(val, py4j.java_gateway.JavaObject):
py4j.java_gateway.get_method(self.script_java, "in")(key, val)
else:
py4j.java_gateway.get_method(
self.script_java, "in")(
key, _py2java(
self.sc, val))
def __init__(self, target_id, gateway_client):
JavaObject.__init__(self, target_id, gateway_client)
self._get = get_method(self, "get")
def get_field(java_object, field_name):
method = get_method(java_object, field_name)
return method()
def __init__(self, target_id, gateway_client):
JavaObject.__init__(self, target_id, gateway_client)
self.java_remove = get_method(self, "remove")