Floordiv operation in tensors...how to achieve

I was trying to use floordiv operation in tensors, it seems it is not supported in nnvm currently, can any one help how to mitigate this problem. Also I found there’s no floor operator, otherwise I could have fused division and floor operators. Please help…

I met the same problem. Have you solved it? How about foor?

I find the math definition: https://en.wikipedia.org/wiki/Floor_and_ceiling_functions#Mod_operator
You could use floor(n) = n - (n % 1). - / % is provided. You could implement floor.

You mean to add a floor operator? then use normal div + floor, is it?

Yes. The key is how to implement floor. You can do like my previous comment. I have implemented it and it works very fine. Otherwise, as far as I can see, you will implement floor for every codegen target(llvm , opencl, cuda…).

Next, you can combine floor and div.

@FrozenGene: I think we should support as below operation as well, but for this i feel better add a floordiv() operator in topi.
image

If we can implement floor / floordiv directly, of course it is very nice.

Floor is a llvm intrinsic, so for llvm, we can introduce floor directly as a intrinsic, see http://docs.tvm.ai/tutorials/language/intrin_math.html#sphx-glr-tutorials-language-intrin-math-py

This should solve floordiv for floating point numbers.

A bit more thoughts need to be put into signed integers, possibly use select or some sign checking tricks