Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for ToBfloat16Type (0.14 sec)

  1. tensorflow/compiler/mlir/quantization/stablehlo/utils/bfloat16_type.cc

    namespace mlir::quant::stablehlo {
    
    bool IsLargeFloatType(Type type) {
      type = getElementTypeOrSelf(type);
      return isa<FloatType>(type) && type.getIntOrFloatBitWidth() > 16;
    }
    
    Type ToBfloat16Type(Type type) {
      if (auto shaped = mlir::dyn_cast<ShapedType>(type)) {
        const Type elem = shaped.getElementType();
        if (IsLargeFloatType(elem)) {
          return shaped.clone(BFloat16Type::get(type.getContext()));
        }
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 1.6K bytes
    - Viewed (0)
  2. tensorflow/compiler/mlir/quantization/stablehlo/passes/convert_func_to_bfloat16.cc

    namespace mlir::quant::stablehlo {
    namespace {
    
    class BFloat16TypeConverter : public TypeConverter {
     public:
      BFloat16TypeConverter() {
        addConversion([](const Type type) -> Type {
          return IsLargeFloatType(type) ? ToBfloat16Type(type) : type;
        });
      }
    };
    
    // This helper function makes legality check easier. Both convert ops in the
    // patterns below are considered legal:
    //  - `BitcastConvertOp` (i32 -> f32) + `ConvertOp` (f32 -> bf16)
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 16:01:03 UTC 2024
    - 9.3K bytes
    - Viewed (0)
Back to top