mxfusion.util.customop

Members

class mxfusion.util.customop.MakeDiagonalOp(**kwargs)

Bases: mxnet.operator.CustomOp

forward(is_train, req, in_data, out_data, aux)

Forward interface. Can override when creating new operators.

Parameters:
  • is_train (bool) – whether this is for training
  • req (list of str) – how to assign to out_data. can be ‘null’, ‘write’, or ‘add’. You can optionally use self.assign(dst, req, src) to handle this.
  • out_data, aux (in_data,) – input, output, and auxiliary states for forward. See document for corresponding arguments of Operator::Forward
backward(req, out_grad, in_data, out_data, in_grad, aux)

Backward interface. Can override when creating new operators.

Parameters:
  • req (list of str) – how to assign to in_grad. can be ‘null’, ‘write’, or ‘add’. You can optionally use self.assign(dst, req, src) to handle this.
  • in_data, out_data, in_grad, aux (out_grad,) – input and output for backward. See document for corresponding arguments of Operator::Backward
class mxfusion.util.customop.MakeDiagonalOpProp

Bases: mxnet.operator.CustomOpProp

list_arguments()

list_arguments interface. Can override when creating new operators.

Returns:arguments – List of argument blob names.
Return type:list
list_outputs()

list_outputs interface. Can override when creating new operators.

Returns:outputs – List of output blob names.
Return type:list
infer_shape(in_shape)

infer_shape interface. Can override when creating new operators.

Parameters:in_shape (list) – List of argument shapes in the same order as declared in list_arguments.
Returns:
  • in_shape (list) – List of argument shapes. Can be modified from in_shape.
  • out_shape (list) – List of output shapes calculated from in_shape, in the same order as declared in list_outputs.
  • aux_shape (Optional, list) – List of aux shapes calculated from in_shape, in the same order as declared in list_auxiliary_states.
create_operator(ctx, shapes, dtypes, **kwargs)

Create an operator that carries out the real computation given the context, input shapes, and input data types.

mxfusion.util.customop.make_diagonal(F, x, name='make_diagonal')
class mxfusion.util.customop.BroadcastToWithSamplesOp(isSamples, shape, **kwargs)

Bases: mxnet.operator.CustomOp

forward(is_train, req, in_data, out_data, aux)

Forward interface. Can override when creating new operators.

Parameters:
  • is_train (bool) – whether this is for training
  • req (list of str) – how to assign to out_data. can be ‘null’, ‘write’, or ‘add’. You can optionally use self.assign(dst, req, src) to handle this.
  • out_data, aux (in_data,) – input, output, and auxiliary states for forward. See document for corresponding arguments of Operator::Forward
backward(req, out_grad, in_data, out_data, in_grad, aux)

Backward interface. Can override when creating new operators.

Parameters:
  • req (list of str) – how to assign to in_grad. can be ‘null’, ‘write’, or ‘add’. You can optionally use self.assign(dst, req, src) to handle this.
  • in_data, out_data, in_grad, aux (out_grad,) – input and output for backward. See document for corresponding arguments of Operator::Backward
class mxfusion.util.customop.BroadcastToWithSamplesOpProp(**kwargs)

Bases: mxnet.operator.CustomOpProp

list_arguments()

list_arguments interface. Can override when creating new operators.

Returns:arguments – List of argument blob names.
Return type:list
list_outputs()

list_outputs interface. Can override when creating new operators.

Returns:outputs – List of output blob names.
Return type:list
infer_shape(in_shapes)

infer_shape interface. Can override when creating new operators.

Parameters:in_shape (list) – List of argument shapes in the same order as declared in list_arguments.
Returns:
  • in_shape (list) – List of argument shapes. Can be modified from in_shape.
  • out_shape (list) – List of output shapes calculated from in_shape, in the same order as declared in list_outputs.
  • aux_shape (Optional, list) – List of aux shapes calculated from in_shape, in the same order as declared in list_auxiliary_states.
create_operator(ctx, in_shapes, in_dtypes, **kwargs)

Create an operator that carries out the real computation given the context, input shapes, and input data types.

mxfusion.util.customop.broadcast_to_w_samples(F, data, shape, isSamples=True)