Skip to content
This repository has been archived by the owner on May 22, 2023. It is now read-only.

[Op][Layout] Add layout_transform operator in Relax. #403

Merged
merged 10 commits into from
Feb 7, 2023

Conversation

psrivas2
Copy link
Contributor

@psrivas2 psrivas2 commented Feb 3, 2023

Adds layout_transform operator in Relax as part of Relax layout planning.

layout_transform takes an input tensor x and an attribute index_map of tir::IndexMap type. It also has an optional pad_value attribute.
It transforms x as per the index_map attribute and returns the transformed tensor.

This operator for now allows layout transformations that introduce implicit padding. For example, transforming a tensor of shape (10,) using the lambda i: (i//4, i%4). The output shape will be (3, 4) with two elements padded. The optional pad_value is used to pad if specified, otherwise the compiler is free to choose any value to pad.

@psrivas2 psrivas2 changed the title [WIP][Op][Layout] Add layout_transform operator in Relax. [Op][Layout] Add layout_transform operator in Relax. Feb 3, 2023
@psrivas2
Copy link
Contributor Author

psrivas2 commented Feb 3, 2023

cc @masahi @sunggg @YuchenJin

Copy link
Collaborator

@MasterJH5574 MasterJH5574 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @psrivas2 for supporting the layout transform op :-) Left a few comments.

src/relax/op/tensor/manipulate.cc Show resolved Hide resolved
src/relax/op/tensor/manipulate.cc Outdated Show resolved Hide resolved
src/relax/op/tensor/manipulate.cc Outdated Show resolved Hide resolved
src/relax/op/tensor/manipulate.cc Outdated Show resolved Hide resolved
src/relax/op/tensor/manipulate.cc Show resolved Hide resolved
@psrivas2 psrivas2 merged commit c09886d into tlc-pack:relax Feb 7, 2023
@psrivas2
Copy link
Contributor Author

psrivas2 commented Feb 7, 2023

Thanks @MasterJH5574 @masahi @tqchen and @YuchenJin for review!

junrushao pushed a commit to junrushao/relax that referenced this pull request Feb 7, 2023
Adds layout_transform operator in Relax as part of Relax layout planning.

layout_transform takes an input tensor x and an attribute index_map of tir::IndexMap type. It also has an optional pad_value attribute. It transforms x as per the index_map attribute and returns the transformed tensor.

This operator for now allows layout transformations that introduce implicit padding. For example, transforming a tensor of shape (10,) using the lambda i: (i//4, i%4). The output shape will be (3, 4) with two elements padded. The optional pad_value is used to pad if specified, otherwise the compiler is free to choose any value to pad.
@psrivas2 psrivas2 deleted the layout-impl branch February 8, 2023 13:49
junrushao pushed a commit that referenced this pull request Feb 8, 2023
Adds layout_transform operator in Relax as part of Relax layout planning.

layout_transform takes an input tensor x and an attribute index_map of tir::IndexMap type. It also has an optional pad_value attribute. It transforms x as per the index_map attribute and returns the transformed tensor.

This operator for now allows layout transformations that introduce implicit padding. For example, transforming a tensor of shape (10,) using the lambda i: (i//4, i%4). The output shape will be (3, 4) with two elements padded. The optional pad_value is used to pad if specified, otherwise the compiler is free to choose any value to pad.
junrushao pushed a commit that referenced this pull request Feb 8, 2023
Adds layout_transform operator in Relax as part of Relax layout planning.

layout_transform takes an input tensor x and an attribute index_map of tir::IndexMap type. It also has an optional pad_value attribute. It transforms x as per the index_map attribute and returns the transformed tensor.

This operator for now allows layout transformations that introduce implicit padding. For example, transforming a tensor of shape (10,) using the lambda i: (i//4, i%4). The output shape will be (3, 4) with two elements padded. The optional pad_value is used to pad if specified, otherwise the compiler is free to choose any value to pad.
junrushao pushed a commit that referenced this pull request Feb 8, 2023
Adds layout_transform operator in Relax as part of Relax layout planning.

layout_transform takes an input tensor x and an attribute index_map of tir::IndexMap type. It also has an optional pad_value attribute. It transforms x as per the index_map attribute and returns the transformed tensor.

This operator for now allows layout transformations that introduce implicit padding. For example, transforming a tensor of shape (10,) using the lambda i: (i//4, i%4). The output shape will be (3, 4) with two elements padded. The optional pad_value is used to pad if specified, otherwise the compiler is free to choose any value to pad.
junrushao pushed a commit that referenced this pull request Feb 8, 2023
Adds layout_transform operator in Relax as part of Relax layout planning.

layout_transform takes an input tensor x and an attribute index_map of tir::IndexMap type. It also has an optional pad_value attribute. It transforms x as per the index_map attribute and returns the transformed tensor.

This operator for now allows layout transformations that introduce implicit padding. For example, transforming a tensor of shape (10,) using the lambda i: (i//4, i%4). The output shape will be (3, 4) with two elements padded. The optional pad_value is used to pad if specified, otherwise the compiler is free to choose any value to pad.
junrushao pushed a commit that referenced this pull request Feb 9, 2023
Adds layout_transform operator in Relax as part of Relax layout planning.

layout_transform takes an input tensor x and an attribute index_map of tir::IndexMap type. It also has an optional pad_value attribute. It transforms x as per the index_map attribute and returns the transformed tensor.

This operator for now allows layout transformations that introduce implicit padding. For example, transforming a tensor of shape (10,) using the lambda i: (i//4, i%4). The output shape will be (3, 4) with two elements padded. The optional pad_value is used to pad if specified, otherwise the compiler is free to choose any value to pad.
junrushao pushed a commit that referenced this pull request Feb 9, 2023
Adds layout_transform operator in Relax as part of Relax layout planning.

layout_transform takes an input tensor x and an attribute index_map of tir::IndexMap type. It also has an optional pad_value attribute. It transforms x as per the index_map attribute and returns the transformed tensor.

This operator for now allows layout transformations that introduce implicit padding. For example, transforming a tensor of shape (10,) using the lambda i: (i//4, i%4). The output shape will be (3, 4) with two elements padded. The optional pad_value is used to pad if specified, otherwise the compiler is free to choose any value to pad.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants