Skip to content

dpctl.tensor.tan returns incorrect result #2893

Open

Description

@antonwolfy

It seems dpctl.tensor.tan returns result which differs with numpy and Intel MKL:

import dpnp, numpy, dpctl, dpctl.tensor as dpt

a = numpy.array([11], dtype='F')
numpy.tan(a)
# Out: array([-225.95084+0.j], dtype=complex64)

ia = dpnp.array(a, device='cpu')
dpnp.tan(ia)
# array([-225.95085+0.j], dtype=complex64)  tan() from Intel MKL is used

na = dpt.asarray(a, device='cpu')
dpt.tan(da)
# Out: usm_ndarray([-225.68439+0.j], dtype=complex64)

na = dpt.asarray(a, device='gpu')
dpt.tan(na)
# Out: usm_ndarray([-225.68439+0.j], dtype=complex64)

# casting to complex128 resolve the issue:
na = dpt.asarray(a, device='cpu', dtype='D')
dpt.tan(na)
# Out: usm_ndarray([-225.95084645+0.j])

Is the behavior expected? Or is there something which needs to be fixed in dpctl?

Activity

  1. ndgrigorian commented on Mar 27, 2025

    @ndgrigorian
    Collaborator

    @antonwolfy
    Can you provide more information about the machine that you took this on?

    I haven't been able to replicate it locally.
    Update: my mistake, I missed that it was complex.
    I can replicate it fine.

  2. ndgrigorian commented on May 5, 2026

    @ndgrigorian
    Collaborator

    Transferred as it is no longer relevant to dpctl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions