예제 #1
0
void print_2D_view(tensor<T, M>& a) {
	for (unsigned int i = 0; i<a.shape(0); i++){
		for (unsigned int j = 0; j<a.shape(1); j++)
			cout<<a(i, j)<<" ";
		cout<<endl;
	}
}
예제 #2
0
void print_3D_view(tensor<T, M>& a) {
	for (unsigned int k = 0; k<a.shape(0); k++) {
		cout<<"dimension 0: "<<k<<endl;
		for (unsigned int i = 0; i<a.shape(1); i++){
			for (unsigned int j = 0; j<a.shape(2); j++)
				cout<<a(k, i, j)<<" ";
			cout<<endl;
		}
	}
}
예제 #3
0
void rand_init(tensor<T, M>& a){
	for (unsigned int i=0; i<a.shape(0);i++)
		a[i] = drand48();
}