def test_size():
 for sparse_type in ('csc_matrix', 'csr_matrix'):
  x = getattr(theano.sparse, sparse_type)()
  y = getattr(scipy.sparse, sparse_type)((5, 7)).astype(config.floatX)
  get_size = theano.function([x], x.size)
  def check():
   assert (y.size == get_size(y))
  check()
  y[(0, 0)] = 1
  check()
  y[(0, 1)] = 0
  check()

def test_size ( ) : for sparse_type in ( 'csc_matrix' , 'csr_matrix' ) : x = getattr ( theano . sparse , sparse_type ) ( ) y = getattr ( scipy . sparse , sparse_type ) ( ( 5 , 7 ) ) . astype ( config . floatX ) get_size = theano . function ( [ x ] , x . size ) def check ( ) : assert ( y . size == get_size ( y ) ) check ( ) y [ ( 0 , 0 ) ] = 1 check ( ) y [ ( 0 , 1 ) ] = 0 check ( )
ensure the size attribute of sparse matrices behaves as in numpy .