/// <summary>ブロードキャスト</summary> public static VariableNode Broadcast(VariableNode x, Shape shape) { while (!((int[])x.Shape).SequenceEqual((int[])shape)) { Function function = new Functions.ArrayManipulation.Broadcast(x.Shape, shape); x = Apply(function, x)[0]; } return(x); }
/// <summary>ブロードキャスト</summary> public static Tensor Broadcast(Tensor x, Shape shape) { while (!((int[])x.Shape).SequenceEqual((int[])shape)) { Function function = new Functions.ArrayManipulation.Broadcast(x.Shape, shape); Tensor y = new Tensor(shape); function.Execute(new Tensor[] { x }, new Tensor[] { y }); x = y; } return(x); }