以下のように関数の中でclassを定義していますが、pass
何も返しません。
一方関数のreturn
はresultになっています。
ここで質問があるのですが、
質問1:このclassを定義する意味はなんなのでしょうか?
質問2: このコードはcifar10のものですが、result = CIFAR10Record()
の部分の意味を教えてください。
def read_cifar10(filename_queue): class CIFAR10Record(object): pass result = CIFAR10Record() label_bytes = 1 # 2 for CIFAR-100 result.height = 128 result.width = 128 result.depth = 3 image_bytes = result.height * result.width * result.depth # 49152 record_bytes = label_bytes + image_bytes reader = tf.FixedLengthRecordReader(record_bytes=record_bytes) # #<tensorflow.python.ops.io_ops.FixedLengthRecordReader at 0x112c44128> result.key, value = reader.read(filename_queue) # # key:<tf.Tensor 'ReaderReadV2:0' shape=() dtype=string> vaule:ReaderReadV2:1' record_bytes = tf.decode_raw(value, tf.uint8) # <tf.Tensor 'DecodeRaw:0' shape=(?,) dtype=uint8> result.label = tf.cast(tf.strided_slice(record_bytes, [0], [label_bytes]), tf.int32) # # <tf.Tensor 'Cast:0' shape=(?,) dtype=int32> depth_major = tf.reshape(tf.strided_slice(record_bytes, [label_bytes], [label_bytes + image_bytes]),[result.depth, result.height, result.width]) # # <tf.Tensor 'Reshape:0' shape=(3, 128, 128) dtype=uint8> result.uint8image = tf.transpose(depth_major, [1, 2, 0]) # <tf.Tensor 'transpose_1:0' shape=(128, 128, 3) dtype=uint8> return result
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/08/30 09:52