Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Full Support for Dynamic Shape #135

Merged
merged 15 commits into from
Oct 11, 2023
Merged

Conversation

hikettei
Copy link
Owner

Changes

Doing !reshape for DynamicShape

TEST> (!reshape (make-input `(N C H W) nil)
		(~ N C H W -> (* N C H) W))
{CPUTENSOR[float] :shape (LazyAxis: f(N C H) = (N*C*H) LazyAxis: W) :id TID2755206 
  :vec-state [maybe-not-computed]
    <<Not allocated: size=(LazyAxis: f(N C H) = (N*C*H) LazyAxis: W)>>
  :facet :input
  :belongs-to :memory-pool
  :requires-grad NIL
  :backward <Node: RESHAPETENSORNODE-T (A[BEFORE] B[AFTER] -> B[AFTER])>}

The shape of AbstractTensor is now given as a LazyAxis structure; which can contain S-expression. This feature is advantageous in networks where the batch-size changes frequently, as it allows operations to be performed without having to recompile. As for CNN, complex shape transmissions can be represented as reported in #132 .

(call (Conv2d 3 6 `(5 5)) (make-input `(N 3 25 25) :X))

is now a valid operation.

@hikettei hikettei merged commit 8391a0a into master Oct 11, 2023
1 check passed
@hikettei hikettei deleted the dynamic-shape-revisit branch October 16, 2023 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant