如何重用变量范围进行批量标准化

时间:2018-10-13 18:31:15

标签: python tensorflow deep-learning

我想两次使用相同的网络。所以,我需要重用变量。我正在使用下面给出的批处理规范化函数,它给了我错误。 这个问题类似于https://github.com/tensorflow/tensorflow/issues/2740,但是我仍然无法找出正确的解决方案。

行:

'use strict';
import React from 'react';
import { View, Text, Dimensions } from 'react-native';
import Carousel from 'react-native-snap-carousel';

const SCREEN_WIDTH = Dimensions.get('screen').width;

const MediaTypeSlider = props => {
    const renderItem = ({ item }) => (
        <Text style={styles.textContentStyle}>{item.toUpperCase()}</Text>
    );

    return (
        <View style={styles.sliderViewStyle}>
            <Carousel
                data={props.mediaTypes}
                renderItem={renderItem}
                sliderWidth={SCREEN_WIDTH}
                itemWidth={80}
                itemHeight={50}
                sliderHeight={50}
                onSnapToItem={props.toggleMediaType}
            />
        </View>
    );
};

const styles = {
    textContentStyle: {
        color: 'white',
        width: 80,
        fontSize: 17,
        textAlign: 'center',
        fontWeight: '500'
    },
    sliderViewStyle: {
        height: 50,
        alignItems: 'center'
    }
};

export default MediaTypeSlider;
  

ValueError:变量   convnet_branch / conv1_1_bn / siamese / convnet_branch_1 / conv1_1_bn / moments / Squeeze / ExponentialMovingAverage /   不存在,或者不是使用tf.get_variable()创建的。你是否   打算在VarScope中设置复用= tf.AUTO_REUSE?

    lambda: (ema.average(batch_mean), ema.average(batch_var)))    
    ema_apply_op = ema.apply([batch_mean, batch_var])

0 个答案:

没有答案
相关问题