Document feedback

Question document fragment

When a question document fragment contains a formula, it is displayed as a space.

Submission type
issue

It's a little complicated...

I'd like to ask someone.

Please select the submission type

Problem type
Specifications and Common Mistakes

- Specifications and Common Mistakes:

- Misspellings or punctuation mistakes,incorrect formulas, abnormal display.

- Incorrect links, empty cells, or wrong formats.

- Chinese characters in English context.

- Minor inconsistencies between the UI and descriptions.

- Low writing fluency that does not affect understanding.

- Incorrect version numbers, including software package names and version numbers on the UI.

Usability

- Usability:

- Incorrect or missing key steps.

- Missing main function descriptions, keyword explanation, necessary prerequisites, or precautions.

- Ambiguous descriptions, unclear reference, or contradictory context.

- Unclear logic, such as missing classifications, items, and steps.

Correctness

- Correctness:

- Technical principles, function descriptions, supported platforms, parameter types, or exceptions inconsistent with that of software implementation.

- Incorrect schematic or architecture diagrams.

- Incorrect commands or command parameters.

- Incorrect code.

- Commands inconsistent with the functions.

- Wrong screenshots.

- Sample code running error, or running results inconsistent with the expectation.

Risk Warnings

- Risk Warnings:

- Lack of risk warnings for operations that may damage the system or important data.

Content Compliance

- Content Compliance:

- Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions.

- Copyright infringement.

Please select the type of question

Problem description

Describe the bug so that we can quickly locate the problem.

mindspore.ops.composite

Composite operators.

Pre-defined combination of operators.

class mindspore.ops.composite.GradOperation(name, get_all=False, get_by_list=False, sens_param=False)[source]

An metafuncgraph object which is used to get the gradient of output of a network(function).

The GradOperation will convert the network(function) into a back propagation graph.

Parameters
  • get_all (bool) – If True, get all the gradients w.r.t inputs. Default: False.

  • get_by_list (bool) – If True, get all the gradients w.r.t Parameter variables. If get_all and get_by_list are both False, get the gradient w.r.t first input. If get_all and get_by_list are both True, get the gradients w.r.t inputs and Parameter variables at the same time in the form of ((grads w.r.t inputs), (grads w.r.t parameters)). Default: False.

  • sens_param (bool) – Whether append sensitivity as input. If sens_param is False, a ‘ones_like(outputs)’ sensitivity will be attached automatically. Default: False.

class mindspore.ops.composite.HyperMap(ops=None)[source]

Hypermap will apply the set operation on input sequences.

Which will apply the operations of every elements of the sequence.

Parameters

ops (Union[MultitypeFuncGraph, None]) – ops is the operation to apply. If ops is None, the operations should be putted in the first input of the instance.

Inputs:
  • args (Tuple[sequence]) - If ops is not None, all the inputs should be the same length sequences, and each row of the sequences. e.g. If args length is 2, and for i in length of each sequence (args[0][i], args[1][i]) will be the input of the operation.

    If ops is not None, the first input is the operation, and the other is inputs.

Outputs:

sequence, the output will be same type and same length of sequence from input and the value of each element is the result of operation apply each row of element. e.g. operation(args[0][i], args[1][i]).

register(*type_names)[source]

Register a function for the given type string.

class mindspore.ops.composite.MultitypeFuncGraph(name)[source]

Generate multiply graph.

MultitypeFuncGraph is a class used to generate graphs for function with different type as input.

Parameters

name (str) – Operator name.

Raises

ValueError – Cannot find matching fn for the given args.

Examples

>>> # `add` is a metagraph object which will add two objects according to
>>> # input type using ".register" decorator.
>>> add = MultitypeFuncGraph('add')
register(*type_names)[source]

Register a function for the given type string.

mindspore.ops.composite.add_flags(fn, **flags)[source]

An interface to add flag for a function.

Note

Only supports bool value.

Parameters
  • fn (Function) – Function or cell to add flag.

  • flags (bool) – Flags use kwargs.

Returns

Function, the fn added flags.

Examples

>>> add_flags(net, predit=True)
mindspore.ops.composite.clip_by_value(x, clip_value_min, clip_value_max)[source]

Clips tensor values to a specified min and max.

Limits the value of x to a range, whose lower limit is ‘clip_value_min’ and upper limit is ‘clip_value_max’.

Note

‘clip_value_min’ needs to be less than or equal to ‘clip_value_max’.

Parameters
  • x (Tensor) – Input data.

  • clip_value_min (Tensor) – The minimum value.

  • clip_value_max (Tensor) – The maximum value.

Returns

Tensor, a clipped Tensor.

mindspore.ops.composite.core(fn=None, **flags)[source]

A decorator to add flag to a function.

By default, the function is marked core=True using this decorator to set flag to a graph.

Parameters
  • fn (Function) – Function to add flag. Default: None.

  • flags (dict) – The following flags can be set core, which indicates that this is a core function or other flag. Default: None.