Operator

class webdnn.graph.operator.Operator(name=None)[source]

Operator a.k.a layer or function in DNN computation graph.

Parameters:name (str) – the name. If None, automatically generated name is used.
append_input(name, var)[source]

Append input variable

Parameters:
  • name (str) – the name of input variable
  • var (Variable) – the variable
append_output(name, var)[source]

Append output variable

Parameters:
  • name (str) – the name of output variable
  • var (Variable) – the variable
copy()[source]

Create new operator instance, which is initialized with parameters same as this operator.

inputs

input variables

outputs

output variables

remove_all()[source]

Remove all input and output variables

remove_input(var)[source]

Remove input variable

Parameters:var (Variable) – the variable
remove_output(var)[source]

Remove output variable

Parameters:var (Variable) – the variable
replace(op_new)[source]

Replace this operator by new operator. all variables connected with this operator will be disconnected and connected to the new operator.

Parameters:op_new (Operator) – the new operator
replace_input(v_old, v_new)[source]

Replace input variable with other variable

Parameters:
  • v_old (Variable) – the variable which is removed
  • v_new (Variable) – the variable which is appended
  • with_assert (bool) – If True, it is checked whether shape and order is same as variable which will be removed
replace_output(v_old, v_new)[source]

Replace output variable with other variable

Parameters:
  • v_old (Variable) – the variable which is removed
  • v_new (Variable) – the variable which is appended
  • with_assert (bool) – If True, it is checked whether shape and order is same as variable which will be removed