无法从android应用程序中的内部存储读取文件

时间:2019-07-10 17:38:20

标签: android performance android-studio android-fragments

我有一个android应用程序,其中有一个导入按钮,该按钮会打开文件浏览器窗口,供用户从内部或外部存储中从任何位置选择任何文件...

它能够成功读取放置在外部存储中的文件,但是当同一文件放置在内部存储中时,它会给出FileNotFound 例外。

def xavier_init(size):
    in_dim = size[0]
    xavier_stddev = 1. / tf.sqrt(in_dim / 2.)
    return tf.random_normal(shape=size, stddev=xavier_stddev)

def leaky_relu(x, alpha=0.2):
  return tf.nn.relu(x) - alpha * tf.nn.relu(-x)

X = tf.placeholder(tf.float32, shape=[None, 9, 15])
W1 = tf.Variable(xavier_init([135, 128]))
b1 = tf.Variable(tf.zeros(shape=[128]))
W11 = tf.Variable(xavier_init([128, 256]))
b11 = tf.Variable(tf.zeros(shape=[256]))
W12 = tf.Variable(xavier_init([256, 512]))
b12 = tf.Variable(tf.zeros(shape=[512]))
W13 = tf.Variable(xavier_init([512, 45]))
b13 = tf.Variable(tf.zeros(shape=[45]))

W2 = tf.Variable(xavier_init([135, 128]))
b2 = tf.Variable(tf.zeros(shape=[128]))
W21 = tf.Variable(xavier_init([128, 256]))
b21 = tf.Variable(tf.zeros(shape=[256]))
W22 = tf.Variable(xavier_init([256, 512]))
b22 = tf.Variable(tf.zeros(shape=[512]))
W23 = tf.Variable(xavier_init([512, 540]))
b23 = tf.Variable(tf.zeros(shape=[540]))

def fcn(x):
    out1 = tf.reshape(x, (-1, 135))
    out1 = leaky_relu(tf.matmul(out1, W1) + b1)
    out1 = leaky_relu(tf.matmul(out1, W11) + b11)
    out1 = leaky_relu(tf.matmul(out1, W12) + b12)
    out1 = leaky_relu(tf.matmul(out1, W13) + b13)
    out1 = tf.reshape(out1, (-1, 9, 5))

    out2 = tf.reshape(x, (-1, 135))
    out2 = leaky_relu(tf.matmul(out2, W2) + b2)
    out2 = leaky_relu(tf.matmul(out2, W21) + b21)
    out2 = leaky_relu(tf.matmul(out2, W22) + b22)
    out2 = leaky_relu(tf.matmul(out2, W23) + b23)
    out2 = tf.reshape(out2, [-1, 9, 4, 15])
    out2 = leaky_relu(tf.matmul(tf.transpose(out2, perm=[0, 2, 1, 3]), tf.transpose(out2, perm=[0, 2, 3, 1])))
    out2 = tf.transpose(out2, perm=[0, 2, 3, 1])
    return [out1, out2]

0 个答案:

没有答案
相关问题