레이어는 노드의 들쭉날쭉 한 배열이며 각 노드는 소스 []와 대상 []으로 세타의 배열을 나타냅니다.2 개의 변수를 하나의 객체에 연결하기
질문 : 왜 네 번째 줄의 코드를 변경하면 다섯 번째 줄에 해당 개체를 연결 한 후에도 여전히 '0'이 인쇄됩니까? 층들이 충전 방식에
theta t = new theta();
layers[1][i].source[j] = t;
layers[0][j].destination[i] = t;
layers[0][j].destination[i].weight = 5;
Console.WriteLine(layers[1][i].source[j].weight);
struct theta
{
public double weight;
public theta(double _weight) { weight = _weight; }
}
class node
{
public theta[] source;
public theta[] destination;
public double activation;
public double delta;
public node() { }
public node(double x) { activation = x; }
}
샘플 : 세타는 STRUCT 아닌 클래스이므로
node n = new node();
n.destination = new theta[numberOfNodesPerHiddenLayer+1];
n.source = new theta[numberOfNodesPerHiddenLayer+1];
layers[i][j] = n;
'layers' 배열이 어떻게 채워지는지 명확히해야합니다. –
인덱스 i와 j가 어디에서 왔는지 불분명하기 때문에 전체 외부/중첩 루프 (해당되는 경우) 코드 스 니펫을 게시하십시오. Rgds, –
클래스 구조 변경 및 모든 작동합니다. 현재 사용하면 거기에 구조가 있다는 점이 없습니다. – ashcliffe