regarding the usage of super( ) .__init__() [closed]
up vote
-2
down vote
favorite
I am reading a code segment related to tensorflow. I am not very clear how to understand the definition of this class
class DatasetDataProvider(data_provider.DataProvider):
def __init__(self,
dataset,
num_readers=1,
reader_kwargs=None,
shuffle=True,
num_epochs=None,
common_queue_capacity=256,
common_queue_min=128,
record_key='record_key',
seed=None,
scope=None):
key, data = parallel_reader.parallel_read(
dataset.data_sources,
reader_class=dataset.reader,
num_epochs=num_epochs,
num_readers=num_readers,
reader_kwargs=reader_kwargs,
shuffle=shuffle,
capacity=common_queue_capacity,
min_after_dequeue=common_queue_min,
seed=seed,
scope=scope)
items = dataset.decoder.list_items()
tensors = dataset.decoder.decode(data, items)
items_to_tensors = dict(zip(items, tensors))
if record_key in items_to_tensors:
raise ValueError('The item name used for `record_key` cannot also be '
'used for a dataset item: %s', record_key)
items_to_tensors[record_key] = key
super(DatasetDataProvider, self).__init__(
items_to_tensors=items_to_tensors,
num_samples=dataset.num_samples)
In specific, I am not sure why it includes to _init_
part. How to understand them from OO design perspective? why in def __init__(self,
we also include
super(DatasetDataProvider, self).__init__(
items_to_tensors=items_to_tensors,
num_samples=dataset.num_samples)
python python-3.x
closed as off-topic by Toby Speight, Sᴀᴍ Onᴇᴌᴀ, vnp, 200_success, Heslacher Nov 16 at 5:05
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Authorship of code: Since Code Review is a community where programmers improve their skills through peer review, we require that the code be posted by an author or maintainer of the code, that the code be embedded directly, and that the poster know why the code is written the way it is." – Toby Speight, Sᴀᴍ Onᴇᴌᴀ, vnp, 200_success, Heslacher
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
up vote
-2
down vote
favorite
I am reading a code segment related to tensorflow. I am not very clear how to understand the definition of this class
class DatasetDataProvider(data_provider.DataProvider):
def __init__(self,
dataset,
num_readers=1,
reader_kwargs=None,
shuffle=True,
num_epochs=None,
common_queue_capacity=256,
common_queue_min=128,
record_key='record_key',
seed=None,
scope=None):
key, data = parallel_reader.parallel_read(
dataset.data_sources,
reader_class=dataset.reader,
num_epochs=num_epochs,
num_readers=num_readers,
reader_kwargs=reader_kwargs,
shuffle=shuffle,
capacity=common_queue_capacity,
min_after_dequeue=common_queue_min,
seed=seed,
scope=scope)
items = dataset.decoder.list_items()
tensors = dataset.decoder.decode(data, items)
items_to_tensors = dict(zip(items, tensors))
if record_key in items_to_tensors:
raise ValueError('The item name used for `record_key` cannot also be '
'used for a dataset item: %s', record_key)
items_to_tensors[record_key] = key
super(DatasetDataProvider, self).__init__(
items_to_tensors=items_to_tensors,
num_samples=dataset.num_samples)
In specific, I am not sure why it includes to _init_
part. How to understand them from OO design perspective? why in def __init__(self,
we also include
super(DatasetDataProvider, self).__init__(
items_to_tensors=items_to_tensors,
num_samples=dataset.num_samples)
python python-3.x
closed as off-topic by Toby Speight, Sᴀᴍ Onᴇᴌᴀ, vnp, 200_success, Heslacher Nov 16 at 5:05
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Authorship of code: Since Code Review is a community where programmers improve their skills through peer review, we require that the code be posted by an author or maintainer of the code, that the code be embedded directly, and that the poster know why the code is written the way it is." – Toby Speight, Sᴀᴍ Onᴇᴌᴀ, vnp, 200_success, Heslacher
If this question can be reworded to fit the rules in the help center, please edit the question.
2
Welcome to Code Review! Unfortunately this post is off-topic for this site. Please read What topics can I ask about here? - note "For licensing, moral, and procedural reasons, we cannot review code written by other programmers. We expect you, as the author, to understand why the code is written the way that it is."
– Aries_is_there
Nov 16 at 0:44
add a comment |
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
I am reading a code segment related to tensorflow. I am not very clear how to understand the definition of this class
class DatasetDataProvider(data_provider.DataProvider):
def __init__(self,
dataset,
num_readers=1,
reader_kwargs=None,
shuffle=True,
num_epochs=None,
common_queue_capacity=256,
common_queue_min=128,
record_key='record_key',
seed=None,
scope=None):
key, data = parallel_reader.parallel_read(
dataset.data_sources,
reader_class=dataset.reader,
num_epochs=num_epochs,
num_readers=num_readers,
reader_kwargs=reader_kwargs,
shuffle=shuffle,
capacity=common_queue_capacity,
min_after_dequeue=common_queue_min,
seed=seed,
scope=scope)
items = dataset.decoder.list_items()
tensors = dataset.decoder.decode(data, items)
items_to_tensors = dict(zip(items, tensors))
if record_key in items_to_tensors:
raise ValueError('The item name used for `record_key` cannot also be '
'used for a dataset item: %s', record_key)
items_to_tensors[record_key] = key
super(DatasetDataProvider, self).__init__(
items_to_tensors=items_to_tensors,
num_samples=dataset.num_samples)
In specific, I am not sure why it includes to _init_
part. How to understand them from OO design perspective? why in def __init__(self,
we also include
super(DatasetDataProvider, self).__init__(
items_to_tensors=items_to_tensors,
num_samples=dataset.num_samples)
python python-3.x
I am reading a code segment related to tensorflow. I am not very clear how to understand the definition of this class
class DatasetDataProvider(data_provider.DataProvider):
def __init__(self,
dataset,
num_readers=1,
reader_kwargs=None,
shuffle=True,
num_epochs=None,
common_queue_capacity=256,
common_queue_min=128,
record_key='record_key',
seed=None,
scope=None):
key, data = parallel_reader.parallel_read(
dataset.data_sources,
reader_class=dataset.reader,
num_epochs=num_epochs,
num_readers=num_readers,
reader_kwargs=reader_kwargs,
shuffle=shuffle,
capacity=common_queue_capacity,
min_after_dequeue=common_queue_min,
seed=seed,
scope=scope)
items = dataset.decoder.list_items()
tensors = dataset.decoder.decode(data, items)
items_to_tensors = dict(zip(items, tensors))
if record_key in items_to_tensors:
raise ValueError('The item name used for `record_key` cannot also be '
'used for a dataset item: %s', record_key)
items_to_tensors[record_key] = key
super(DatasetDataProvider, self).__init__(
items_to_tensors=items_to_tensors,
num_samples=dataset.num_samples)
In specific, I am not sure why it includes to _init_
part. How to understand them from OO design perspective? why in def __init__(self,
we also include
super(DatasetDataProvider, self).__init__(
items_to_tensors=items_to_tensors,
num_samples=dataset.num_samples)
python python-3.x
python python-3.x
asked Nov 15 at 21:27
user288609
1171
1171
closed as off-topic by Toby Speight, Sᴀᴍ Onᴇᴌᴀ, vnp, 200_success, Heslacher Nov 16 at 5:05
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Authorship of code: Since Code Review is a community where programmers improve their skills through peer review, we require that the code be posted by an author or maintainer of the code, that the code be embedded directly, and that the poster know why the code is written the way it is." – Toby Speight, Sᴀᴍ Onᴇᴌᴀ, vnp, 200_success, Heslacher
If this question can be reworded to fit the rules in the help center, please edit the question.
closed as off-topic by Toby Speight, Sᴀᴍ Onᴇᴌᴀ, vnp, 200_success, Heslacher Nov 16 at 5:05
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Authorship of code: Since Code Review is a community where programmers improve their skills through peer review, we require that the code be posted by an author or maintainer of the code, that the code be embedded directly, and that the poster know why the code is written the way it is." – Toby Speight, Sᴀᴍ Onᴇᴌᴀ, vnp, 200_success, Heslacher
If this question can be reworded to fit the rules in the help center, please edit the question.
2
Welcome to Code Review! Unfortunately this post is off-topic for this site. Please read What topics can I ask about here? - note "For licensing, moral, and procedural reasons, we cannot review code written by other programmers. We expect you, as the author, to understand why the code is written the way that it is."
– Aries_is_there
Nov 16 at 0:44
add a comment |
2
Welcome to Code Review! Unfortunately this post is off-topic for this site. Please read What topics can I ask about here? - note "For licensing, moral, and procedural reasons, we cannot review code written by other programmers. We expect you, as the author, to understand why the code is written the way that it is."
– Aries_is_there
Nov 16 at 0:44
2
2
Welcome to Code Review! Unfortunately this post is off-topic for this site. Please read What topics can I ask about here? - note "For licensing, moral, and procedural reasons, we cannot review code written by other programmers. We expect you, as the author, to understand why the code is written the way that it is."
– Aries_is_there
Nov 16 at 0:44
Welcome to Code Review! Unfortunately this post is off-topic for this site. Please read What topics can I ask about here? - note "For licensing, moral, and procedural reasons, we cannot review code written by other programmers. We expect you, as the author, to understand why the code is written the way that it is."
– Aries_is_there
Nov 16 at 0:44
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
2
Welcome to Code Review! Unfortunately this post is off-topic for this site. Please read What topics can I ask about here? - note "For licensing, moral, and procedural reasons, we cannot review code written by other programmers. We expect you, as the author, to understand why the code is written the way that it is."
– Aries_is_there
Nov 16 at 0:44