MCPcopy Create free account
hub / github.com/NVIDIA/cutlass / CreateConv2dFewChannelsOperator

Function CreateConv2dFewChannelsOperator

python/cutlass_library/generator.py:729–771  ·  view source on GitHub ↗
(manifest, layout, tile_descriptions, data_type, channel_counts, \
  conv_kinds = [ConvKind.Fprop, ConvKind.Dgrad, ConvKind.Wgrad], \
  epilogue_functor = EpilogueFunctor.LinearCombination, swizzling_functor = SwizzlingFunctor.Identity4)

Source from the content-addressed store, hash-verified

727
728# Convolution for 2D operations specialized for few channels
729def CreateConv2dFewChannelsOperator(manifest, layout, tile_descriptions, data_type, channel_counts, \
730 conv_kinds = [ConvKind.Fprop, ConvKind.Dgrad, ConvKind.Wgrad], \
731 epilogue_functor = EpilogueFunctor.LinearCombination, swizzling_functor = SwizzlingFunctor.Identity4):
732
733 element_a, element_b, element_c, element_epilogue = data_type
734
735 # one exceptional case
736
737 # iterator algorithm (analytic and optimized)
738 iterator_algorithms = [IteratorAlgorithm.FewChannels,]
739
740 # by default, only generate the largest tile size, largest alignment, and optimized iterator
741 if manifest.kernel_filter == '':
742 tile_descriptions = [tile_descriptions[0],]
743 channel_counts = [channel_counts[0],]
744
745 operations = []
746
747 for tile in tile_descriptions:
748 for channel_count in channel_counts:
749
750 alignment_c = EpilogueAlignment(channel_count, tile)
751
752 A = TensorDescription(element_a, layout[0], channel_count)
753 B = TensorDescription(element_b, layout[1], channel_count)
754 C = TensorDescription(element_c, layout[2], alignment_c)
755
756 swizzling_functor_ = swizzling_functor
757
758 #
759 # Conv2d Fprop
760 #
761 if ConvKind.Fprop in conv_kinds:
762
763 # Strided support for Analytic and Optimized Fprop
764 for iterator_algorithm in iterator_algorithms:
765 new_operation = Conv2dOperation(ConvKind.Fprop, iterator_algorithm, tile.minimum_compute_capability, tile,\
766 A, B, C, element_epilogue, StrideSupport.Strided, epilogue_functor, swizzling_functor_)
767
768 manifest.append(new_operation)
769 operations.append(new_operation)
770
771 return operations
772
773# Convolution for 3D operations
774def CreateConv3dOperator(manifest, layout, tile_descriptions, data_type, alignment, \

Calls 4

EpilogueAlignmentFunction · 0.85
TensorDescriptionClass · 0.70
Conv2dOperationClass · 0.70
appendMethod · 0.45

Tested by

no test coverage detected