Skip to content

TypeError: 'float' object cannot be interpreted as an integer #241

@shizukanaskytree

Description

@shizukanaskytree

I run the example:
6 - Multi GPU - Basic Operations on multi-GPU

This cell gives error

# Example: compute A^n + B^n on 2 GPUs

# Create random large matrix
A = np.random.rand(1e4, 1e4).astype('float32')
B = np.random.rand(1e4, 1e4).astype('float32')

# Creates a graph to store results
c1 = []
c2 = []

# Define matrix power
def matpow(M, n):
    if n < 1: #Abstract cases where n < 1
        return M
    else:
        return tf.matmul(M, matpow(M, n-1))
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-b090f05e85b9> in <module>()
      2 
      3 # Create random large matrix
----> 4 A = np.random.rand(1e4, 1e4).astype('float32')
      5 B = np.random.rand(1e4, 1e4).astype('float32')
      6 

mtrand.pyx in mtrand.RandomState.rand()

mtrand.pyx in mtrand.RandomState.random_sample()

mtrand.pyx in mtrand.cont0_array()

TypeError: 'float' object cannot be interpreted as an integer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions