fn

is_same_size

bool
is_same_size(a: Tensor, b: Tensor)
source

Predicate: do two tensors have identical shapes?

Compares the shape tuples exactly — no broadcasting compatibility is implied. Use lucid.broadcast_shapes if broadcastability is the question.

Parameters

aTensor
First tensor.
bTensor
Second tensor.

Returns

bool

True iff tuple(a.shape) == tuple(b.shape).

Notes

Compares all dimensions including singleton axes:

out=i(shapea[i]=shapeb[i]).\text{out} = \bigwedge_{i} (\text{shape}_a[i] = \text{shape}_b[i]).

A (1, 3) tensor is not the same size as a (3,) tensor, even though they broadcast.

Examples

>>> import lucid
>>> a = lucid.zeros(2, 3)
>>> b = lucid.ones(2, 3)
>>> lucid.is_same_size(a, b)
True