    def stride(self, dim: int) -> int:
        """
        Returns stride (a number) for the given dim.
        Note that dim is based on self.original_shapes.
        This API assumes that all dims after dim are static (IntImm).

        Throws RuntimeError if such a stride number cannot be computed.
        """

        for i, d in enumerate(self.original_shapes[dim + 1 :], dim + 1):
            if not isinstance(d, IntImm):
                raise RuntimeError(
                    f"Can only calculate static stride from static dim: {i}, "
                    f"original shapes: {self.original_shapes}."
                )
        strides = self.try_get_stride_strs(dim)
        if strides is None:
            raise RuntimeError("Failed to get stride strs!")
        stride = 1
        for s in strides:
            stride *= int(s)
        return stride
Returns stride (a number) for the given dim.
Note that dim is based on self.original_shapes.
This API assumes that all dims after dim are static (IntImm).

Throws RuntimeError if such a stride number cannot be computed.
python/aitemplate/compiler/tensor_accessor.py