---
title: SoftmaxCrossEntropyWithLogitsPass
description: "该融合将符合图融合pattern的reshape+SoftmaxCrossEntropyWithLogits算子，融合后消除Reshape算子，仅保留SoftmaxCrossEntropyWithLogits算子。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/maintenref/graphubfusionref/atlasrr_30_0146.html
sourcePath: /source/zh/canncommercial/900/maintenref/graphubfusionref/atlasrr_30_0146.html
indexId: bdf905fb41dba82b2cbb3d98ef4acac397f8eb745de02204e61e2d3c3e45bcb478
---
# SoftmaxCrossEntropyWithLogitsPass

#### 融合模式

该融合将符合图融合pattern的reshape+SoftmaxCrossEntropyWithLogits算子，融合后消除Reshape算子，仅保留SoftmaxCrossEntropyWithLogits算子。


#### 使用约束

- 输入、输出参数的shape约束：
  input0、input2、input4的shape必须是4D。

- 输入、输出参数的format约束：
  input0、input2的format必须是NHWC，C<131072。

- 输入参数的顺序约束：

  - input0、input2必须是Reshape的第一个输入。
  - SoftmaxCrossEntropyWithLogits的第一个输出必须是Reshape的第一个输入。
- 性能说明：
  融合规则在C=1的场景时，性能有提升。

  如果有性能劣化，考虑关闭该融合规则。

- 输入参数的数据类型约束：
input0、input2的数据类型保持一致。

  - Atlas A2 训练系列产品 / Atlas A2 推理系列产品：数据类型支持FLOAT32、BFLOAT16。


#### 支持的型号

Atlas A2 训练系列产品 / Atlas A2 推理系列产品
