MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / _elementwise_op

Function _elementwise_op

python/paddle/tensor/math.py:649–719  ·  view source on GitHub ↗
(helper)

Source from the content-addressed store, hash-verified

647
648
649def _elementwise_op(helper):
650 op_type = helper.layer_type
651 original_op_type = helper.kwargs.get('original_op_type', op_type)
652 x = helper.kwargs.get('x', None)
653 y = helper.kwargs.get('y', None)
654
655 out = helper.kwargs.get('out', None)
656
657 assert x is not None, f'x cannot be None in {original_op_type}'
658 assert y is not None, f'y cannot be None in {original_op_type}'
659 bf16_and_complex_supported_ops = [
660 "elementwise_add",
661 "elementwise_sub",
662 "elementwise_mul",
663 "elementwise_div",
664 "elementwise_max",
665 "elementwise_pow",
666 ]
667 if original_op_type in bf16_and_complex_supported_ops:
668 data_type = [
669 'uint16',
670 'float16',
671 'float32',
672 'float64',
673 'int32',
674 'int64',
675 'bool',
676 'complex64',
677 'complex128',
678 ]
679 else:
680 data_type = [
681 'float16',
682 'uint16',
683 'float32',
684 'float64',
685 'int32',
686 'int64',
687 'bool',
688 ]
689 check_variable_and_dtype(
690 x,
691 'x',
692 data_type,
693 original_op_type,
694 )
695 check_variable_and_dtype(
696 y,
697 'y',
698 data_type,
699 original_op_type,
700 )
701
702 axis = helper.kwargs.get('axis', -1)
703 name = helper.kwargs.get('name', None)
704
705 if out is None:
706 if name is None:

Callers 10

powFunction · 0.85
divideFunction · 0.85
floor_divideFunction · 0.85
remainderFunction · 0.85
mulFunction · 0.85
_add_with_axisFunction · 0.85
_subtract_with_axisFunction · 0.85
_multiply_with_axisFunction · 0.85
_divide_with_axisFunction · 0.85
fracFunction · 0.85

Calls 6

check_variable_and_dtypeFunction · 0.85
getMethod · 0.45
create_variableMethod · 0.45
append_opMethod · 0.45
append_activationMethod · 0.45

Tested by

no test coverage detected