GithubHelp home page GithubHelp logo

aten::repeat_interleave is considered an unsupported Tensor and causing an error when trying to convert to TFLite about tinyneuralnetwork HOT 2 CLOSED

MariosHavWaller avatar MariosHavWaller commented on July 20, 2024
aten::repeat_interleave is considered an unsupported Tensor and causing an error when trying to convert to TFLite

from tinyneuralnetwork.

Comments (2)

peterjc123 avatar peterjc123 commented on July 20, 2024 1

It is actually a quite complicated operator to translate. It has the following usages.
For example, we have x = torch.tensor([[1,2],[3,4]]) and the function signature torch.repeat_interleave(input, repeats=None, dim=None)

  1. torch.repeat_interleave(x, 2)
  2. torch.repeat_interleave(x, torch.tensor([1,2,3,4]))
  3. torch.repeat_interleave(x, torch.tensor([1,2]), dim=0)
  4. torch.repeat_interleave(x.flatten())

They can be split into two very different categories.

  1. if repeats is int and dim is None, then it can be translated as x.reshape(-1,1).repeat(1,repeats).view(-1)
  2. For other cases, we need to transform the repeats to indices to make the operation like a indexing operation.
len_repeats = len(repeats) # For `repeats` as an int, it should be the size of the dim
raw_indices = torch.arange(len_repeats)
indices = torch.repeat_interleave(raw_indices, repeats) # This can be calculated by concatenating the tiled raw_indices. e.g. [0] * 1 + [1] * 2 + [2] * 3

from tinyneuralnetwork.

peterjc123 avatar peterjc123 commented on July 20, 2024 1

Well, I think I will not implement the logic for dynamic repeats tensor because it may lead to dynamic-shaped tensors.

from tinyneuralnetwork.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.