Skip to content

[JIT] Support a single TensorList argument anywhere in the argument list#8141

Closed
jamesr66a wants to merge 5 commits intopytorch:masterfrom
jamesr66a:tensorlist
Closed

[JIT] Support a single TensorList argument anywhere in the argument list#8141
jamesr66a wants to merge 5 commits intopytorch:masterfrom
jamesr66a:tensorlist

Conversation

@jamesr66a
Copy link
Collaborator

No description provided.

SET(MKL_VERSION)
ENDIF (MKL_LIBRARIES)

set(MKL_FIND_REQUIRED Off)

This comment was marked as off-topic.

if sum(arg['simple_type'] == 'TensorList' for arg in arguments) > 1:
return False
# omit einsum
if any(arg['simple_type'] == 'std::string' for arg in arguments):

This comment was marked as off-topic.


real_inputs = count()
if has_tensorlist:
kw_assignments.append('size_t _Arg_idx = 0;')

This comment was marked as off-topic.

# the first argument, that is then followed by a number of positional args.
if arg['simple_type'] == 'TensorList':
arguments.append('peekSlice(stack, 0, varargs_length - {}, varargs_length)'.format(static_inputs))
kw_assignments.append('size_t _Arg_idx_{} = _Arg_idx;'.format(i))

This comment was marked as off-topic.

Copy link
Contributor

@zdevito zdevito left a comment

Choose a reason for hiding this comment

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

I think a tweak to this approach would make it more robust:

Let's say you have

a b c [d e f g] h i # [] is the list

We extract a, b, c, with peek(0, N) where N is the number of arguments. We can adjust N before and after the varargs list is encountered to make peek(i, N) still always extract the ith static argument.

Before tensor_list, set N to (num_static_args - 1 + num_args_in_list)

a b c [d e f g] h i # [] is the list
~~~~~~~~~~~~ <- N

When we handle the varargs_list, then adjust N to be
num_static_args

a b c [d e f g] h i # [] is the list
              ~~~~~~ <- N

if has_tensorlist:
kw_assignments.append('size_t _Arg_idx = 0;')
for i, arg in enumerate(decl['arguments']):
# XXX: we currently support only TensorList ops that have a TensorList as

This comment was marked as off-topic.

elif is_tensor_arg(arg):
arguments.append('std::move(peek(stack, {}, {}))'.format(next(real_inputs), static_inputs))
if has_tensorlist:
kw_assignments.append('size_t _Arg_idx_{} = _Arg_idx++;'.format(i))

This comment was marked as off-topic.

@jamesr66a
Copy link
Collaborator Author

@jamesr66a jamesr66a closed this Jun 5, 2018
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.

3 participants