Skip to content

BUG: pt.full doesn't work with int shape #758

Closed
@williambdean

Description

@williambdean

Describe the issue:

numpy.full works with shape as int and the pt.full docstring suggests that it works like numpy. However, this case does not work with current main branch of pytensor

Reproducable code example:

import pytensor.tensor as pt
import numpy as np

# Works
pt.full((5, 3), 3)

# Doesn't work
pt.full(5, 3) # TypeError see below
np.full(5, 3) # array([3, 3, 3, 3, 3])

# Work around
pt.full((5,), 3)

Error message:

Traceback (most recent call last):
    pt.full(5, 3)
  File "/home/.../pytensor/tensor/basic.py", line 1722, in full
    return alloc(fill_value, *shape)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Value after * must be an iterable, not int

PyTensor version information:

current main branch

Context for the issue:

Trying to switch out numpy with pytensor

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions