PermuteContract.permute_duplicate_axis: def of bendtorch-core@0.1.0.0 Import: import bendtorch-core@0.1.0.0/src/tensor/permute_contract.bend as PermuteContract Lines 177-227 of bendtorch-core@0.1.0.0/src/tensor/permute_contract.bend: https://jend.leeeet.dev/read.txt?path=bendtorch-core@0.1.0.0/src/tensor/permute_contract.bend&start_line=177&end_line=227 import Base import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape import bendtorch-core@0.1.0.0/src/storage/LAWS.bend as StorageLaws import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core import bendtorch-core@0.1.0.0/src/tensor/layout.bend as Layout import bendtorch-core@0.1.0.0/src/tensor/transforms.bend as Transforms import bendtorch-core@0.1.0.0/src/tensor/read_contract.bend as Reads import bendtorch-core@0.1.0.0/src/tensor/transform_observation.bend as Observation import bendtorch-core@0.1.0.0/src/tensor/transform_records.bend as Laws def permute_duplicate_axis(+input: Shape.Shape, +fill: F32, +axes: List<&2, U32>, ranked: {Nat.is_eq(Shape.rank_dimensions(axes), Shape.rank_dimensions(Shape.dimensions(input))) == True{} : Bool}, bounded: {Layout.bounded(axes, Shape.rank(input)) == True{} : Bool}, duplicate: {Layout.unique(axes) == False{} : Bool}) -> Laws.RetainedFailure: +ranked = ranked +bounded = bounded +duplicate = duplicate Laws.RetainedFailure{ Reads.new_lift(input, fill, result => {Observation.failure_code(input, Observation.Permute{axes}, result) == Some{14} : Maybe<&2, U32>}, valid => retained_code(input, fill, valid, Observation.Permute{axes}, Transforms.LayoutError{Layout.DuplicateAxis{}}, planned_failure(input, Core.TTensor{StorageLaws.created(Shape.count(input), fill), valid}, axes, Layout.DuplicateAxis{}, Equal.trans(Result<&2, &2, Layout.Error, Layout.Plan>, Layout.permutation(input, axes), Layout.plan_bounded(input, axes, Shape.bool_case(Layout.bounded(axes, Shape.rank(input)))), Fail{Layout.DuplicateAxis{}}, ranked_pass(input, axes, Shape.bool_case(Nat.is_eq(Shape.rank_dimensions(axes), Shape.rank_dimensions(Shape.dimensions(input)))), ranked), Equal.trans(Result<&2, &2, Layout.Error, Layout.Plan>, Layout.plan_bounded(input, axes, Shape.bool_case(Layout.bounded(axes, Shape.rank(input)))), Layout.plan_unique(input, axes, Shape.bool_case(Layout.unique(axes))), Fail{Layout.DuplicateAxis{}}, bounded_pass(input, axes, Shape.bool_case(Layout.bounded(axes, Shape.rank(input))), bounded), unique_failure(input, axes, Shape.bool_case(Layout.unique(axes)), duplicate)))))), Reads.new_lift(input, fill, result => {Observation.kept_dimensions(input, Observation.Permute{axes}, result) == Some{Shape.dimensions(input)} : Maybe<&2, List<&2, U32>>}, valid => retained_dimensions(input, fill, valid, Observation.Permute{axes}, Transforms.LayoutError{Layout.DuplicateAxis{}}, planned_failure(input, Core.TTensor{StorageLaws.created(Shape.count(input), fill), valid}, axes, Layout.DuplicateAxis{}, Equal.trans(Result<&2, &2, Layout.Error, Layout.Plan>, Layout.permutation(input, axes), Layout.plan_bounded(input, axes, Shape.bool_case(Layout.bounded(axes, Shape.rank(input)))), Fail{Layout.DuplicateAxis{}}, ranked_pass(input, axes, Shape.bool_case(Nat.is_eq(Shape.rank_dimensions(axes), Shape.rank_dimensions(Shape.dimensions(input)))), ranked), Equal.trans(Result<&2, &2, Layout.Error, Layout.Plan>, Layout.plan_bounded(input, axes, Shape.bool_case(Layout.bounded(axes, Shape.rank(input)))), Layout.plan_unique(input, axes, Shape.bool_case(Layout.unique(axes))), Fail{Layout.DuplicateAxis{}}, bounded_pass(input, axes, Shape.bool_case(Layout.bounded(axes, Shape.rank(input))), bounded), unique_failure(input, axes, Shape.bool_case(Layout.unique(axes)), duplicate)))))), Reads.new_lift(input, fill, result => {Observation.kept_length(input, Observation.Permute{axes}, result) == Some{Shape.logical_numel(Shape.dimensions(input))} : Maybe<&2, Nat>}, valid => retained_length(input, fill, valid, Observation.Permute{axes}, Transforms.LayoutError{Layout.DuplicateAxis{}}, planned_failure(input, Core.TTensor{StorageLaws.created(Shape.count(input), fill), valid}, axes, Layout.DuplicateAxis{}, Equal.trans(Result<&2, &2, Layout.Error, Layout.Plan>, Layout.permutation(input, axes), Layout.plan_bounded(input, axes, Shape.bool_case(Layout.bounded(axes, Shape.rank(input)))), Fail{Layout.DuplicateAxis{}}, ranked_pass(input, axes, Shape.bool_case(Nat.is_eq(Shape.rank_dimensions(axes), Shape.rank_dimensions(Shape.dimensions(input)))), ranked), Equal.trans(Result<&2, &2, Layout.Error, Layout.Plan>, Layout.plan_bounded(input, axes, Shape.bool_case(Layout.bounded(axes, Shape.rank(input)))), Layout.plan_unique(input, axes, Shape.bool_case(Layout.unique(axes))), Fail{Layout.DuplicateAxis{}}, bounded_pass(input, axes, Shape.bool_case(Layout.bounded(axes, Shape.rank(input))), bounded), unique_failure(input, axes, Shape.bool_case(Layout.unique(axes)), duplicate)))))), Reads.new_lift(input, fill, result => {Observation.kept_count(input, Observation.Permute{axes}, result) == Some{Shape.count(input)} : Maybe<&2, U32>}, valid => retained_count(input, fill, valid, Observation.Permute{axes}, Transforms.LayoutError{Layout.DuplicateAxis{}}, planned_failure(input, Core.TTensor{StorageLaws.created(Shape.count(input), fill), valid}, axes, Layout.DuplicateAxis{}, Equal.trans(Result<&2, &2, Layout.Error, Layout.Plan>, Layout.permutation(input, axes), Layout.plan_bounded(input, axes, Shape.bool_case(Layout.bounded(axes, Shape.rank(input)))), Fail{Layout.DuplicateAxis{}}, ranked_pass(input, axes, Shape.bool_case(Nat.is_eq(Shape.rank_dimensions(axes), Shape.rank_dimensions(Shape.dimensions(input)))), ranked), Equal.trans(Result<&2, &2, Layout.Error, Layout.Plan>, Layout.plan_bounded(input, axes, Shape.bool_case(Layout.bounded(axes, Shape.rank(input)))), Layout.plan_unique(input, axes, Shape.bool_case(Layout.unique(axes))), Fail{Layout.DuplicateAxis{}}, bounded_pass(input, axes, Shape.bool_case(Layout.bounded(axes, Shape.rank(input))), bounded), unique_failure(input, axes, Shape.bool_case(Layout.unique(axes)), duplicate)))))), other => inside => Reads.new_lift(input, fill, result => {Observation.kept_value(input, Observation.Permute{axes}, other, result) == Some{fill} : Maybe<&2, F32>}, valid => retained_value(input, fill, valid, Observation.Permute{axes}, Transforms.LayoutError{Layout.DuplicateAxis{}}, other, inside, planned_failure(input, Core.TTensor{StorageLaws.created(Shape.count(input), fill), valid}, axes, Layout.DuplicateAxis{}, Equal.trans(Result<&2, &2, Layout.Error, Layout.Plan>, Layout.permutation(input, axes), Layout.plan_bounded(input, axes, Shape.bool_case(Layout.bounded(axes, Shape.rank(input)))), Fail{Layout.DuplicateAxis{}}, ranked_pass(input, axes, Shape.bool_case(Nat.is_eq(Shape.rank_dimensions(axes), Shape.rank_dimensions(Shape.dimensions(input)))), ranked), Equal.trans(Result<&2, &2, Layout.Error, Layout.Plan>, Layout.plan_bounded(input, axes, Shape.bool_case(Layout.bounded(axes, Shape.rank(input)))), Layout.plan_unique(input, axes, Shape.bool_case(Layout.unique(axes))), Fail{Layout.DuplicateAxis{}}, bounded_pass(input, axes, Shape.bool_case(Layout.bounded(axes, Shape.rank(input))), bounded), unique_failure(input, axes, Shape.bool_case(Layout.unique(axes)), duplicate))))))} Uses (43): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Equal.trans https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.is_eq https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/core.bend&name=Shape https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/core.bend&name=bool_case https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/core.bend&name=count https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/core.bend&name=dimensions https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/core.bend&name=logical_numel https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/core.bend&name=rank https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/shape/core.bend&name=rank_dimensions https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/storage/LAWS.bend&name=created https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/core.bend&name=Tensor https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/layout.bend&name=Error https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/layout.bend&name=Plan https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/layout.bend&name=bounded https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/layout.bend&name=permutation https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/layout.bend&name=plan_bounded https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/layout.bend&name=plan_unique https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/layout.bend&name=unique https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/permute_contract.bend&name=bounded_pass https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/permute_contract.bend&name=planned_failure https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/permute_contract.bend&name=ranked_pass https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/permute_contract.bend&name=retained_code https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/permute_contract.bend&name=retained_count https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/permute_contract.bend&name=retained_dimensions https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/permute_contract.bend&name=retained_length https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/permute_contract.bend&name=retained_value https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/permute_contract.bend&name=unique_failure https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/read_contract.bend&name=new_lift https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/transform_observation.bend&name=Request https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/transform_observation.bend&name=failure_code https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/transform_observation.bend&name=kept_count https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/transform_observation.bend&name=kept_dimensions https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/transform_observation.bend&name=kept_length https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/transform_observation.bend&name=kept_value https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/transform_records.bend&name=RetainedFailure https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/tensor/transforms.bend&name=Error