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.

PR

Just a small problem.

I can fix it online!

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.

mindflow.cell.DiffusionTransformer

View Source On Gitee
class mindflow.cell.DiffusionTransformer(in_channels, out_channels, hidden_channels, layers, heads, time_token_cond=True, compute_dtype=mstype.float32)[source]

Diffusion model with Transformer backbone implementation.

Parameters
  • in_channels (int) – The number of input channel.

  • out_channels (int) – The number of output channel.

  • hidden_channels (int) – The number of hidden channel.

  • layers (int) – The number of transformer block layers.

  • heads (int) – The number of transformer heads.

  • time_token_cond (bool) – Whether to use timestep as condition token. Default: True.

  • compute_dtype (mindspore.dtype) – The dtype of compute, it can be mstype.float32 or mstype.float16. Default: mstype.float32, indicates mindspore.float32.

Inputs:
  • x (Tensor) - The input has a shape of (batch_size,sequence_len,in_channels).

  • timestep (Tensor) - The timestep input has a shape of (batch_size,).

Outputs:
  • output (Tensor) - The output has a shape of (batch_size,sequence_len,out_channels).

Supported Platforms:

Ascend

Examples

>>> from mindspore import ops
>>> from mindflow.cell import DiffusionTransformer
>>> in_channels, out_channels, hidden_channels, layers, heads, batch_size, seq_len = 16, 16, 256, 3, 4, 8, 256
>>> model = DiffusionTransformer(in_channels=in_channels,
...                              out_channels=out_channels,
...                              hidden_channels=hidden_channels,
...                              layers=layers,
...                              heads=heads)
>>> x = ops.rand((batch_size, seq_len, in_channels))
>>> timestep = ops.randint(0, 1000, (batch_size,))
>>> output = model(x, timestep)
>>> print(output.shape)
(8, 256, 16)